Could you please take a look at the documentation for my new module and let me know if it makes sense? I always find that I am too close to the module and know what everything is supposed to do. In short, I have the Curse of Knowledge!
Why is it you only find typos after publishing?
The second raw_embedding method should read test_embedding in both the heading and the sample code. I've corrected this error now.
Thank you greatly for helping me get this right...
Edit:
Changed title from "RFC - Documentation Review" to "Please review documentation of my AI::Embedding module" as considered by erzuuli
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: RFC - Documentation Review
by hv (Prior) on Jun 02, 2023 at 22:21 UTC | |
Typos: compatator; tyhe; chargable (should be chargeable [1]); "will random" => "will be random"; ACKNOWLEDGEMENTS section misses a trailing full stop. Interface: returning the HTTP::Tiny response object on failure of various methods means you always need to call success (or error) to know how to look at the response. If I were using this, I'd rather it returned something more easily testable such as undef - the HTTP::Tiny response could be included in the error() return value, or be provided by a separate http_error method. Interface: it seems strange to have the comparator be built in to the object. To me it would make more sense to have the comparator method return a subref (and remove it as a new option). Text: "It requires the 'key' parameter." is not needed, the following sentence already says this (and it is reiterated with the individual parameter listing). Use of the word "homogeneous" is odd: I'm not sure in what way the string form is more "homogeneous" than the array form. The text generally seems to assume that the only use for this interface is to rank search matches, I'm not sure how appropriate that is. More generally I'm unsure about calling the class "Embedding": if I correctly understand what I've read, an instance of this class is not an embedding but an embedder - it is something capable of providing embeddings. Hope this helps. :) [1] I use the phrase "city centre; cat cut cot" to remind me that in almost all English words, a 'c' or 'g' is hard when followed by 'i' or 'e', but soft when followed by 'a', 'u' or 'o'. Thus "chargable" can't be right - it would have to be pronounced with a hard 'g', so it gets an extra 'e' inserted to make it soft. Similarly "manageable" and "enforceable"; but "reproducible" is fine. | [reply] [d/l] [select] |
by Bod (Parson) on Jun 02, 2023 at 23:05 UTC | |
Thank you hv for your valued input. Typos: compatator; tyhe; chargable (should be chargeable 1); "will random" => "will be random"; ACKNOWLEDGEMENTS section misses a trailing full stop. All corrected. I use Grammarly for all the writing I do. But it doesn't work in my text editor so doesn't correct errors in POD. Perhaps I need to copy POD into something Grammarly does check before uploading it. returning the HTTP::Tiny response object on failure of various methods means... Good point! it seems strange to have the comparator be built in to the object. I feel the term 'comparator' is unclear. But I cannot think of a better one! If you can suggest a better method name, that would be great. Use of the word "homogeneous" is odd I mean that one would not be interested in the discreet values of the array, only the array as a whole. Because the whole array needs to be stored as a whole and not as parts, it makes sense (to me at least) to have it as a "homogeneous" string of values. This is easy to store in a database. Hope this helps. :) Tremendously thank you :) | [reply] [d/l] [select] |
by hv (Prior) on Jun 03, 2023 at 01:38 UTC | |
I feel the term 'comparator' is unclear. But I cannot think of a better one! I have no problem with the name, only with the interface - it doesn't make sense (as far as I can see) to embed the comparator within the object. Apart from anything else that makes it harder to have multiple comparators, for no obvious benefit. I'm imagining a simple curry like:
.. and documentation like:
Update: I forgot to include the extra work for comparator, it should probably look more like:
.. where _compare_vector would be factored out of the last 9 lines of compare. | [reply] [d/l] [select] |
by Bod (Parson) on Jun 03, 2023 at 11:31 UTC | |
by hv (Prior) on Jun 03, 2023 at 14:12 UTC | |
by afoken (Chancellor) on Jun 03, 2023 at 12:23 UTC | |
by Bod (Parson) on Jun 11, 2023 at 13:12 UTC | |
Use of the word "homogeneous" is odd I've been doing some weekend reading on PyTorch - not because I want to use it but because I want a high-level understanding of what it does and what it is used for... In the Wikipedia article, they too use the word "homogeneous" to describe the multi-dimensional arrays. "PyTorch defines a class called Tensor (torch.Tensor) to store and operate on homogeneous multidimensional rectangular arrays of numbers." | [reply] |
by kcott (Archbishop) on Jun 11, 2023 at 14:37 UTC | |
I'm not familiar with PyTorch so this is purely a guess. In the examples, all of the array elements are floating point numbers: that's probably what homogeneous means in this context. By contrast, arrays with a mix of floats, integers, strings, objects, and so on, would be heterogeneous. — Ken | [reply] |
Re: RFC - Documentation Review
by kcott (Archbishop) on Jun 03, 2023 at 00:51 UTC | |
G'day Bod, I always start my POD with:
It's part of my template for module code so I don't have to do anything manually to get this. See "perlpod: =encoding encodingname" if you're unfamiliar with this POD command. "... under the same terms as the Perl 5 programming language system itself." This looks strained (for want of a better word). I'd remove the word "system"; and consider whether I even want "itself". "Why is it you only find typos after publishing?" Checking your own work is not the best idea because your brain already knows what you meant and that's what it tends to see. However, if you're like me, you don't have the benefit of a proof-reader on hand. I generally try to read POD in different contexts:
Each of those will likely provide a slightly different view; typos will tend to be more prominent. Changing the width of your screen may also give a different view; I can never be bothered to go to that much effort. I see you have 't/pod.t' with Test::Pod which should pick up typos in POD commands (e.g. =begun); and 't/pod-coverage.t' with Test::Pod::Coverage which should pick up typos in subroutine names. However, these are set up as "Author tests" and, from "Test::More fails...", you don't seem to be running these:
Those are messages for users installing your module; you should do `export RELEASE_TESTING=1` before your `make test` (or similar; e.g. I see gmake test in that post). In addition, there are other Test::Pod::* modules which you may find helpful. I don't use any of these, so I'll make no recommendations, but I see some for checking spelling, links, and so on. Search for these from MetaCPAN. — Ken | [reply] [d/l] [select] |
by Bod (Parson) on Jun 03, 2023 at 11:23 UTC | |
>> "... under the same terms as the Perl 5 programming language system itself." Good point... I see you have 't/pod.t' with Test::Pod which should pick up typos I noticed those as well but haven't touched them as I don't understand them and note that publishing the module works without altering them. Again, they were added by Module::Starter. First, I want to get the module published, available and usable...then I will (hopefully) get a better understanding of how I can improve the details and the system for creating and publishing modules so that future ones will be better. Seems like the POD tests need to be looked at first :) | [reply] [d/l] [select] |
by kcott (Archbishop) on Jun 03, 2023 at 19:08 UTC | |
"... haven't touched them as I don't understand them and note that publishing the module works without altering them." You should run all of your tests and ensure they pass before even thinking about publishing. If you don't understand them, read the documentation: Test::Pod & Test::Pod::Coverage. If you don't understand the documentation, ask us — you would be fully aware that we're more than happy to help. I downloaded the tarball from the "Here is the documentation" link, https://metacpan.org/release/BOD/AI-Embedding-0.1_2/view/lib/AI/Embedding.pm, that you provided in your OP: "https://cpan.metacpan.org/authors/id/B/BO/BOD/AI-Embedding-0.1_2.tar.gz". I set up a directory for testing, then unpacked the tarball, giving:
Those are the files you should have in front of you (albeit in a different parent directory). Here's what you should do:
I'm running Perl v5.36.0; I pretty sure that has nothing to do with any of your test failures. Here's points regarding those problems:
Test::CheckManifest — I've had no end of problems with this module. Just to demonstrate, I installed it and reran `make install`:
I gave up on this module some years ago and instead use what it suggests in "Test::CheckManifest - REPLACE THIS MODULE". I use more descriptive test names:
"Again, they were added by Module::Starter." You are under no obligation to use that directly. I use Module::Starter::PBP as a plugin. Here's my config:
I have multiple directories under /home/ken/.module-starter/ for different Perl versions and different types of modules; P536 is for Perl v5.36.0 templates. Depending on what you decide after receiving advice on "How Critical is Critic?", this plugin may be useful in that respect. I don't use it for that purpose. What I like is the ability to customise the templates; I'm no longer locked in to what Module::Starter provides. Consider the hoops you had to jump through when dealing with "CPAN Ratings..."; you could have just made a text change to your own template; I acknowledge that was a good learning exercise with respect to GitHub. — Ken | [reply] [d/l] [select] |
by Bod (Parson) on Jun 04, 2023 at 22:10 UTC | |
by kcott (Archbishop) on Jun 05, 2023 at 00:37 UTC | |
| |
by Bod (Parson) on Jun 04, 2023 at 22:20 UTC | |
by kcott (Archbishop) on Jun 05, 2023 at 00:45 UTC | |
|