SynonymsMixin

class squirro_client.topic.SynonymsMixin

Bases: object

Methods Summary

delete_synonym_list(project_id, synonyms_id)

Deletes a synonym list

get_synonym_list(project_id, synonyms_id)

Returns a synonym list.

get_synonym_lists(project_id)

Returns all synonym lists for a particular project.

modify_synonym_list(project_id, synonyms_id)

Modifies an existing synonym list

new_synonym_list(project_id, title, synonyms)

Creates a new synonym list

Methods Documentation

delete_synonym_list(project_id, synonyms_id)

Deletes a synonym list

Parameters
  • project_id – Project Identifier

  • synonyms_id – Synonyms Identifier

Example:

>>> client.delete_synonym_list('Sz7LLLbyTzy_SddblwIxaA',
 'H2DKVGU8Sv-GpMlQ7PDnqw')
{}
get_synonym_list(project_id, synonyms_id)

Returns a synonym list.

Parameters
  • project_id – Project Identifier

  • synonyms_id – Synonyms Identifier

Example:

>>> client.get_synonym_list('Sz7LLLbyTzy_SddblwIxaA',
 'H2DKVGU8Sv-GpMlQ7PDnqw')
{u'project_id': u'Sz7LLLbyTzy_SddblwIxaA',
 u'synonyms_id': u'H2DKVGU8Sv-GpMlQ7PDnqw',
 u'title': u'english names',
 u'synonyms': [
  u'humorous,comical,hilarious,hysterical',
  u'attractive,pretty,lovely,stunning'
 ]}
get_synonym_lists(project_id)

Returns all synonym lists for a particular project.

Parameters

project_id – Project Identifier

Example:

>>> client.get_synonym_lists('Sz7LLLbyTzy_SddblwIxaA')
[
    {
        "id": "QAxn9i3tShWqrPmIIeVt4w",
        "created_at": "2020-06-08T12:07:34",
        "modifield_at": "2020-06-08T12:10:57",
        "project_id": "Tq416ObCTLKZEHY-RCUSBQ",
        "title": "Synonyms for Title, Body & Abstract",
        "synonyms": [
            "apple, water melon => fruit"
        ]
    }
]
modify_synonym_list(project_id, synonyms_id, title=None, synonyms=None)

Modifies an existing synonym list

Parameters
  • project_id – Project Identifier

  • synonyms_id – Synonyms Identifier

  • title – Synonyms title, use to recognize your synonyms, e.g. ‘english name synonyms’

  • synonyms – List of Synonyms definitions. Each definition is a comma separated group of synonyms. Example: [‘humorous,comical,hilarious’, ‘attractive,stunning’]

Example:

>>> client.modify_synonym_list('Sz7LLLbyTzy_SddblwIxaA',
 'H2DKVGU8Sv-GpMlQ7PDnqw',
 'english names',
 ['humorous,comical,hilarious,hysterical',
  'attractive,pretty,lovely,stunning'])
new_synonym_list(project_id, title, synonyms)

Creates a new synonym list

Parameters
  • project_id – Project Identifier

  • title – Synonyms title, use to recognize your synonyms, e.g. ‘english name synonyms’

  • synonyms – list of synonym definitions. Each definition is a comma separated group of synonyms. Example: [‘humorous,comical,hilarious’, ‘attractive,stunning’]

Example:

>>> client.new_synonym_list('Sz7LLLbyTzy_SddblwIxaA',
 'general english synonyms',
  ['humorous,comical,hilarious,hysterical',
   'attractive,pretty,lovely,stunning'])
{u'project_id': u'Sz7LLLbyTzy_SddblwIxaA',
 u'synonyms_id': u'H2DKVGU8Sv-GpMlQ7PDnqw',
 u'title': u'general english synonyms',
 u'location': u'/v0/squirro/projects/Sz7LLLbyTzy_SddblwIxaA
 /synonyms/H2DKVGU8Sv-GpMlQ7PDnqw'}