nlp_architect.common package

Submodules

nlp_architect.common.config module

Generic config object:
load config from json file load config from ordinary python dict export config as dictionaty or json string define in init default parameters
class nlp_architect.common.config.Config(**kwargs)[source]

Bases: abc.ABC

Quantization Configuration Object

ATTRIBUTES = {}
classmethod from_dict(json_object)[source]

Constructs a config from a Python dictionary of parameters.

classmethod from_json_file(json_file)[source]

Constructs Config from a json file of parameters.

to_dict()[source]

Serializes this instance to a Python dictionary.

to_json_string()[source]

Serializes this instance to a JSON string.

nlp_architect.common.core_nlp_doc module

class nlp_architect.common.core_nlp_doc.CoreNLPDoc(doc_text: str = '', sentences: list = None)[source]

Bases: object

Object for core-components (POS, Dependency Relations, etc).

_doc_text

the doc text

_sentences

list of sentences, each word in a sentence is represented by a dictionary, structured as follows: {‘start’: (int), ‘len’: (int), ‘pos’: (str), ‘ner’: (str), ‘lemma’: (str), ‘gov’: (int), ‘rel’: (str)}

brat_doc()[source]

Returns doc adapted to BRAT expected input.

static decoder(obj)[source]
displacy_doc()[source]

Return doc adapted to displacyENT expected input.

doc_text
static from_spacy(spacy_doc, show_tok=True, show_doc=True, ptb_pos=False)[source]
json()[source]

Returns json representations of the object.

pretty_json()[source]

Returns pretty json representations of the object.

sent_iter()[source]
sent_text(i)[source]
sentences
nlp_architect.common.core_nlp_doc.find_correct_index(orig_gov, merged_punct_sentence)[source]
nlp_architect.common.core_nlp_doc.fix_gov_indexes(merged_punct_sentence, sentence)[source]
nlp_architect.common.core_nlp_doc.merge_punct_tok(merged_punct_sentence, last_merged_punct_index, punct_text, is_traverse)[source]
nlp_architect.common.core_nlp_doc.merge_punctuation(sentence)[source]

nlp_architect.common.high_level_doc module

class nlp_architect.common.high_level_doc.HighLevelDoc[source]

Bases: object

object for annotation documents

Parameters:
  • self.doc_text (str) – document text
  • self.annotation_set (list(str)) – list of all annotations in doc
  • self.spans (list(dict)) – list of span dict, each span_dict is structured as follows: { ‘end’: (int), ‘start’: (int), ‘type’: (str) string of annotation }
displacy_doc()[source]

Return doc adapted to displacyENT expected input

json()[source]

Return json representations of the object

Returns:json representations of the object
Return type:json
pretty_json()[source]

Return pretty json representations of the object

Returns:pretty json representations of the object
Return type:json

Module contents