Gismo#

Tools to make gismos. WIP

gismap.gismo.make_gismo(lab, vectorizer_parameters=None)[source]#

Makes a gismo out of a lab.

Parameters:
  • lab (LabMap) – Lab that contains publications.

  • vectorizer_parameters (dict) – Overriding parameters for the Countvectorizer of the gismo.

Returns:

gismo – Gismo of the lab.

Return type:

Gismo

gismap.gismo.make_post_publi(lab)[source]#

Hook to turn publication key stored in a corpus into actual publication.

Parameters:

lab (LabMap) – Lab that contains the corpus publications.

Return type:

callable

class gismap.search.Search(gismo, action_list, post=None, corrector=True)[source]#

Builds a gismo search engine.

Parameters:
  • gismo (Gismo) – Gismo to use.

  • action_list (list) – List of actions to perform.

  • post (callable, optional) – Output transformation.

  • corrector (Bool, default=True) – Implement word correction.

class gismap.search.SearchAction(name=None, post=None)[source]#

Base class for extracting search results from a Gismo.

Subclasses should implement process() to define how to extract results from the gismo.

Parameters:
  • name (str, optional) – Name of this action (used as key in results dict).

  • post (callable, optional) – Post-processing function applied to results.

process(gismo)[source]#

Extract results from the gismo. Must be implemented by subclasses.

Parameters:

gismo (Gismo) – The gismo to query.

Return type:

Results (type depends on subclass).

run(gismo)[source]#

Execute the action and apply post-processing.

Parameters:

gismo (Gismo) – The gismo to query.

Return type:

Post-processed results.

class gismap.search.SearchDocuments(name='articles', post=None, k=5)[source]#

Gives k best covering articles.

process(gismo)[source]#

Extract results from the gismo. Must be implemented by subclasses.

Parameters:

gismo (Gismo) – The gismo to query.

Return type:

Results (type depends on subclass).

class gismap.search.SearchFeatures(name='keywords', post=None)[source]#

Gives best keywords.

process(gismo)[source]#

Extract results from the gismo. Must be implemented by subclasses.

Parameters:

gismo (Gismo) – The gismo to query.

Return type:

Results (type depends on subclass).

class gismap.search.SearchLandmarks(name='landmarks', post=None, lmks=None)[source]#

Gives best landmarks.

process(gismo)[source]#

Extract results from the gismo. Must be implemented by subclasses.

Parameters:

gismo (Gismo) – The gismo to query.

Return type:

Results (type depends on subclass).

gismap.search.l2t(lis)[source]#
Parameters:

lis (list) – List of text.

Returns:

Concatenation, comma-separated.

Return type:

str

gismap.search.p2t(publis)[source]#
Parameters:

publis (list) – List of publications

Returns:

Publications converted in text and concatenated.

Return type:

str

gismap.search.publi_to_html(publi)[source]#

Convert a publication to an HTML list item.

Parameters:

publi (Publication) – Publication to convert.

Returns:

HTML list item string.

Return type:

str

gismap.search.publis_to_html(publis)[source]#

Convert a list of publications to an HTML unordered list.

Parameters:

publis (list) – List of publications.

Returns:

HTML unordered list string.

Return type:

str

gismap.search.search_to_html(res)[source]#
Parameters:

res (dict) – Raw results of search.

Returns:

HTML representation of the results.

Return type:

str

gismap.search.search_to_text(res)[source]#
Parameters:

res (dict) – Raw results of search.

Returns:

Text representation of the results.

Return type:

str