Name
Text::Match - Match text question against possible answer strings
Synopsis
Description
Match text question against possible answer strings
Version 20201221.
The following sections describe the methods in each functional area of this module. For an alphabetic listing of all methods by name see Index.
Match Text
Match some text against possible answers
response($Q, $A)
Respond to a question with a plausible answer
Parameter Description
1 $Q Question
2 $A Possible answers
Example:
is_deeply response("a c", ["a b c", "a b c d"]), "a b c"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("a c", ["a b c", "a b c d"]), "a b c"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("a d", ["a b c", "a b c d"]), "a b c d"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("b d", ["a b c d", "a b c d e"]), "a b c d"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("b d", ["a b c d", "a b c d e"]), "a b c d"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("b e", ["a b c d", "a b c d e"]), "a b c d e"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("c a", ["a b c", "a b c d"]), "a b c"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("c a", ["a b c", "a b c d"]), "a b c"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("d a", ["a b c", "a b c d"]), "a b c d"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("d b", ["a b c d", "a b c d e"]), "a b c d"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("d b", ["a b c d", "a b c d e"]), "a b c d"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("e b", ["a b c d", "a b c d e"]), "a b c d e"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("c a b", ["a b c", "a b c d"]), "a b c"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("c a d", ["a b c", "a b c d"]), "a b c d"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
is_deeply response("c a b d", ["a b c", "a b c d", "C a b d"]), "a b c d"; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
Index
1 response - Respond to a question with a plausible answer
Installation
This module is written in 100% Pure Perl and, thus, it is easy to read, comprehend, use, modify and install via cpan:
sudo cpan install TextMatch
Author
Copyright
Copyright (c) 2016-2021 Philip R Brenan.
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.