ResolveAbbreviations

class helper_functions.abbreviation_solver.ResolveAbbreviations(text=None, person=None, dictionaries=None, user=None, password=None, *args, **kwargs)[source]

Used to resolve abbreviations in German Texts. For resolving it uses several resources:

  • A list of German words
  • A list of common German abbreviations
  • A list of abbreviations used in the Austrian Bibliographic Dictionary (ÖBL)
  • and an API that allows to query the Austrian Media Corpus (AMC)

Example:

abbrev = ResolveAbbreviations(text='test text', person=['Müller', 'Peter'], user='user', password='pw')
resolved_text = abbrev.resolve(always_amc=True)
Parameters:
  • text (str) – The text that should be processed (unicode string)
  • person (list) – List of names of the Person (used to create possible abbreviations of the Person names)
  • dictionaries (str or tuple or list) – Dictionary that should be used additionally
  • user (str) – User for the sketch engine
  • password (str) – Password for the sketch engine
resolve(always_amc=False)[source]

Resolve function. Resolves the abbreviation in the text given in the __init__ function.

Parameters:always_amc(Boolean) Specifies whether to also use the AMC for unambiguous abbreviations. Defaults to False.
Returns:Resolved text.
Return type:string

GenericRDFParser

class helper_functions.RDFparsers.GenericRDFParser(uri, kind, app_label_entities=’entities’, app_label_relations=’relations’, app_label_vocabularies=’vocabularies’, **kwargs)[source]

A generic class for parsing RDFs to the APIS data model and save objects to the db.

Attributes:

  • self.objct: (object) the object created by the parser
  • self.labels: (list) list of labels created by the parser (only saved when self.save() is called)
  • self.related_objcts: (list) list of related objects (relations) (only saved when self.save() is called)
  • self.kind: (string) kind of entity of the object (Persion, Place, Institution, Work, Event)
  • self.uri: (string) uri provided when initializing the object
  • self.saved: (boolean) indicates whether the object was saved to the db
  • self.created: (boolean) indicates whether the object was created
Parameters:
  • uri – (url) Uri to parse the object from (http://test.at). The uri must start with a base url mentioned in the RDF parser settings file.
  • kind – (string) Kind of entity (Person, Place, Institution, Work, Event)
  • app_label_entities – (string) Name of the Django app that contains the entities that we create.
  • app_label_relations – (string) Name of the Django app that contains the relations for the merging process.
  • app_label_vocabularies – (string) Name of the Django app that contains the vocabularies defining the entities and relations.
get_or_create()[source]
Returns:Returns the parsed object. Saves it to the db when needed
merge(m_obj, app_label_relations=’relations’)[source]
Parameters:
  • m_obj – the object to merge with (must be an django model object instance)
  • app_label_relations – (string) the label of the Django app that contains the relations
Returns:

django object saved to db or False if nothing was saved

save()[source]
Returns:django object saved to db or False if nothing was saved