Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guessing a package for a given documented name #1173

Open
olexandr-konovalov opened this issue Feb 28, 2017 · 0 comments
Open

Guessing a package for a given documented name #1173

olexandr-konovalov opened this issue Feb 28, 2017 · 0 comments
Assignees
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements topic: packages issues or PRs related to package handling, or specific to a package (for packages w/o issue tracker)

Comments

@olexandr-konovalov
Copy link
Member

olexandr-konovalov commented Feb 28, 2017

Inspired by #1135, I've modified a bit IsDocumentedWord, and now I can do the following:

gap> GuessPackage("PcNormalizedUnitGroup");
[ "laguna" ]
gap> GuessPackage("Set");
[ "reference" ]
gap> GuessPackage("set");
[  ]
gap> GuessPackage("set",false);
[ "reference" ]
gap> GuessPackage("AutomorphismGroup");
[ "reference", "autpgrp", "fga", "gpd not loaded", "guava", "loops not loaded", "sophus" ]
gap> GuessPackage("Centralizer");
[ "fga", "polycyclic", "polycyclic", "wedderga", "xmod not loaded" ]

The code does this:

GuessPackage := function( arg ) 

  local inid, word, case, simple, cword, book, matches, a, match, res;

  inid:= Union( CHARS_DIGITS, CHARS_UALPHA, "_", CHARS_LALPHA );
  word := arg[1];
  if Length( arg ) > 1 and arg[2] = false then
    case:= LowercaseString;
  else
    case:= IdFunc;
  fi;
  res:=[];
  simple:= SIMPLE_STRING( word );
  cword:= case( word );
  for book in HELP_KNOWN_BOOKS[1] do
    matches:= HELP_GET_MATCHES( [ book ], simple, true );
    for a in Concatenation( matches ) do
      match:= case( StripEscapeSequences( a[1].entries[ a[2] ][1] ) );
      if match = cword then
        Append(res,[book]);
      fi;
    od;
  od;
  return res;
end;

Recording this as an issue, as it needs more testing.

By the way, we have

gap> ?IsDocumentedWord
Help: no matching entry found
Help: 'IsDocumentedWord' is currently undocumented.
      For details, try ?Undocumented Variables

and

gap> IsDocumentedWord("a",true);
true
gap> IsDocumentedWord("the",true);
true
gap> IsDocumentedWord("over",true);
true
@olexandr-konovalov olexandr-konovalov added the topic: packages issues or PRs related to package handling, or specific to a package (for packages w/o issue tracker) label Mar 1, 2017
@fingolfin fingolfin added the kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements label May 9, 2017
@olexandr-konovalov olexandr-konovalov self-assigned this Sep 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements topic: packages issues or PRs related to package handling, or specific to a package (for packages w/o issue tracker)
Projects
None yet
Development

No branches or pull requests

2 participants