SyntacticModel

class mowl.base_models.SyntacticModel(*args, corpus_filepath=None, **kwargs)[source]

Bases: Model

Base class for syntactic methods. By syntactic, we mean methods that use the syntax of the ontology to generate the corpus.

Parameters:

corpus_filepath (str) – the filepath where the corpus is saved. If None, the corpus file is saved in a temporary file.

Attributes Summary

corpus

Corpus generated from the ontology.

corpus_filepath

Path for saving the corpus.

Methods Summary

generate_corpus([save, with_annotations])

Generates the corpus of the training ontology.

train()

Abstract method for training the model.

Attributes Documentation

corpus

Corpus generated from the ontology.

Return type:

list

corpus_filepath

Path for saving the corpus.

Return type:

str

Methods Documentation

generate_corpus(save=True, with_annotations=False)[source]

Generates the corpus of the training ontology. It uses the Manchester OWL Syntax.

Parameters:
  • save (bool) – if True, the corpus is saved into the model filepath, otherwise, the corpus is returned as a list of sentences. Default is True.

  • with_annotations – if True, the corpus is generated with the annotations, otherwise, the corpus is generated only with the axioms. Default is False.

train()[source]

Abstract method for training the model. This method must be implemented in children classes