Skip to content

Commit

Permalink
tweak docs and rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrowder committed Jan 20, 2024
1 parent 0df5b9a commit af3be94
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ DESCRIPTION

**Abbreviations** is a module with one automatically exported subroutine, `abbreviations`, which takes as input a set of words and returns the original set with added unique abbreviations for the set. (Note the input words are also abbreviations in the context of this module.)

Its signature:

sub abbreviations($word-set, #= Str, List, or Hash (Set)
:$out-type = HA, #= the default, HashAbbrev
:$lower-case, #= convert the word st to lowercase
:$min-length, #= minimum abbreviation length
) is export {...}

A *word* satisfies the Raku regex `$word ~~ /\S+/` which is quite loose. Using programs can of course further restrict that if need be. For example, for use with module **Opt::Handler** words must satisfy this regex: `$word ~~ /<ident>/`.

A natural consequence of generating all the abbreviations for a set of one word is this: the output provides a regex alternation which matches any partial length of the target word. For example, given a target word 'Args':

use Abbreviations;
Expand All @@ -40,16 +50,6 @@ A natural consequence of generating all the abbreviations for a set of one word
}
is $res, True; # OUTPUT: «ok 1␤»

Its signature:

sub abbreviations($word-set, #= Str, List, or Hash (Set)
:$out-type = HA, #= the default, HashAbbrev
:$lower-case, #= convert the word st to lowercase
:$min-length, #= minimum abbreviation length
) is export {...}

A *word* satisfies the Raku regex `$word ~~ /\S+/` which is quite loose. Using programs can of course further restrict that if need be. For example, for use with module **Opt::Handler** words must satisfy this regex: `$word ~~ /<ident>/`.

As shown in the example above, limiting the input set to one word results in the output of a regex alternation string. The rest of this description applies to sets of two or more words. The input word set can be in one of three forms: (1) a list (recommended), (2) a string containing the words separated by spaces, or (3) as a hash (or set) with the words being keys of the hash (set members). Duplicate words will be automatically and quietly eliminated.

Note the input word set will not be modified unless the `:lower-case` option is used. In that case, all characters will be transformed to lower-case and any new duplicate words deleted.
Expand Down
38 changes: 19 additions & 19 deletions docs/README.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,26 @@ returns the original set with added unique abbreviations for the set.
(Note the input words are also abbreviations in the context of this
module.)


Its signature:

=begin code
sub abbreviations($word-set, #= Str, List, or Hash (Set)
:$out-type = HA, #= the default, HashAbbrev
:$lower-case, #= convert the word st to lowercase
:$min-length, #= minimum abbreviation length
) is export {...}
=end code

A I<word> satisfies the Raku regex C<$word ~~ /\S+/> which is quite
loose. Using programs can of course further restrict that if need
be. For example, for use with module B<Opt::Handler> words must
satisfy this regex: C<$word ~~ /<ident>/>.

A natural consequence of generating all the abbreviations for a
set of one word is this: the output
provides a regex alternation which matches any
partial length of the target word. For example, given a target
word 'Args':
set of one word is this: the output provides a regex alternation
which matches any partial length of the target word. For example,
given a target word 'Args':

=begin code
use Abbreviations;
Expand All @@ -47,21 +62,6 @@ for @w {
is $res, True; # OUTPUT: «ok 1␤»
=end code

Its signature:

=begin code
sub abbreviations($word-set, #= Str, List, or Hash (Set)
:$out-type = HA, #= the default, HashAbbrev
:$lower-case, #= convert the word st to lowercase
:$min-length, #= minimum abbreviation length
) is export {...}
=end code

A I<word> satisfies the Raku regex C<$word ~~ /\S+/> which is quite
loose. Using programs can of course further restrict that if need
be. For example, for use with module B<Opt::Handler> words must
satisfy this regex: C<$word ~~ /<ident>/>.

As shown in the example above, limiting the input set to one word
results in the output of a regex alternation string. The rest
of this description applies to sets of two or more words.
Expand Down

0 comments on commit af3be94

Please sign in to comment.