lexnlp.extract.common.annotations package

Submodules

lexnlp.extract.common.annotations.act_annotation module

class lexnlp.extract.common.annotations.act_annotation.ActAnnotation(coords: Tuple[int, int], locale: str = 'en', act_name: str = '', section: str = '', year: int = None, ambiguous: bool = False, text: str = '')

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'act'

create an object of ActAnnotation like cp = ActAnnotation(name=’name’, coords=(0, 100), text=’text text’)

to_dictionary_legacy() → dict

lexnlp.extract.common.annotations.amount_annotation module

class lexnlp.extract.common.annotations.amount_annotation.AmountAnnotation(coords: Tuple[int, int], locale: str = 'en', value: float = 0, text: str = '')

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'amount'

create an object of AmountAnnotation like cp = AmountAnnotation(name=’name’, coords=(0, 100), text=’text text’)

lexnlp.extract.common.annotations.citation_annotation module

class lexnlp.extract.common.annotations.citation_annotation.CitationAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = '', volume: int = None, volume_str: str = None, year: int = None, reporter: str = None, reporter_full_name: str = None, page: int = None, page_range: str = None, court: str = None, source: str = None, article: int = None, paragraph: str = None, subparagraph: str = None, letter: str = None, sentence: int = None, date: str = None, part: str = None, year_str: str = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'citation'

create an object of CitationAnnotation like cp = CitationAnnotation(name=’name’, coords=(0, 100), text=’text text’)

to_dictionary_legacy() → Dict[str, Any]

lexnlp.extract.common.annotations.company_annotation module

class lexnlp.extract.common.annotations.company_annotation.CompanyAnnotation(coords: Tuple[int, int], locale: str = 'en', name: Optional[str] = None, name_abbr: Optional[str] = None, company_type_full: Optional[str] = None, company_type_abbr: Optional[str] = None, company_type_label: Optional[str] = None, description: Optional[str] = None, text: Optional[str] = None, counter: int = 1)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

company_type
get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'company'

create an object of CompanyAnnotation like cp = CompanyAnnotation(name=’name’, coords=(0, 100), text=’text text’)

lexnlp.extract.common.annotations.condition_annotation module

class lexnlp.extract.common.annotations.condition_annotation.ConditionAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, condition: str = None, pre: str = None, post: str = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'condition'

create an object of ConditionAnnotation like cp = ConditionAnnotation(name=’name’, coords=(0, 100), text=’text text’)

lexnlp.extract.common.annotations.constraint_annotation module

class lexnlp.extract.common.annotations.constraint_annotation.ConstraintAnnotation(coords: Tuple[int, int], locale: str = 'en', constraint: str = None, pre: str = None, post: str = None, text: str = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'constraint'

create an object of ConstraintAnnotation like cp = ConstraintAnnotation(name=’name’, coords=(0, 100), text=’text text’)

lexnlp.extract.common.annotations.copyright_annotation module

class lexnlp.extract.common.annotations.copyright_annotation.CopyrightAnnotation(coords: Tuple[int, int], locale: str = 'en', name: str = '', sign: str = '', company: str = '', text: str = '', date: str = '', year_start: Union[int, str] = '', year_end: Union[str, int] = '')

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'copyright'

create an object of CopyrightAnnotation like cp = CopyrightAnnotation(name=’name’, coords=(0, 100), text=’text text’)

lexnlp.extract.common.annotations.court_annotation module

class lexnlp.extract.common.annotations.court_annotation.CourtAnnotation(coords: Tuple[int, int], locale: str = 'en', name: str = '', text: str = '', jurisdiction: str = '', court_type: str = '')

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'court'

create an object of CourtAnnotation like cp = CourtAnnotation(name=’name’, coords=(0, 100), text=’text text’)

lexnlp.extract.common.annotations.court_citation_annotation module

class lexnlp.extract.common.annotations.court_citation_annotation.CourtCitationAnnotation(coords: Tuple[int, int], locale: str = 'en', name: str = '', short_name: str = None, text: str = None, translated_name: str = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'court citation'

create an object of CourtCitationAnnotation like cp = CourtCitationAnnotation(name=’name’, coords=(0, 100), text=’text text’)

lexnlp.extract.common.annotations.cusip_annotation module

class lexnlp.extract.common.annotations.cusip_annotation.CusipAnnotation(coords: Tuple[int, int], locale: str = 'en', name: str = '', text: str = None, code: str = None, internal: bool = None, ppn: str = None, tba: dict = None, checksum: str = None, issue_id: str = None, issuer_id: str = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'cusip'

create an object of CusipAnnotation like cp = CusipAnnotation(coords=(0, 100))

to_dictionary_legacy() → Dict[str, Any]

lexnlp.extract.common.annotations.date_annotation module

class lexnlp.extract.common.annotations.date_annotation.DateAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, date: datetime.date = None, score: float = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'date'

create an object of ActAnnotation like cp = ActAnnotation(name=’name’, coords=(0, 100), text=’text text’)

lexnlp.extract.common.annotations.definition_annotation module

class lexnlp.extract.common.annotations.definition_annotation.DefinitionAnnotation(coords: Tuple[int, int], locale: str = 'en', name: str = '', text: str = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
get_extracted_text(full_text: str) → str
record_type = 'definition'

create an object of DefinitionAnnotation like cp = DefinitionAnnotation(name=’name’, coords=(0, 100), text=’text text’)

lexnlp.extract.common.annotations.distance_annotation module

class lexnlp.extract.common.annotations.distance_annotation.DistanceAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, amount: float = None, distance_type: str = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'distance'

create an object of DistanceAnnotation like cp = DistanceAnnotation(coords=(0, 100), value=‘101 km’)

lexnlp.extract.common.annotations.duration_annotation module

class lexnlp.extract.common.annotations.duration_annotation.DurationAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, amount: float = None, prefix: str = None, duration_days: float = None, duration_type: str = None, duration_type_en: str = None, is_complex: bool = False)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'duration'

create an object of DurationAnnotation like cp = DurationAnnotation(coords=(0, 100), value=‘101 ms’)

lexnlp.extract.common.annotations.geo_annotation module

class lexnlp.extract.common.annotations.geo_annotation.GeoAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, name: str = None, alias: str = None, name_en: str = None, source: str = None, entity_category: str = None, iso_3166_2: str = None, iso_3166_3: str = None, year: int = None, entity_id: int = None, entity_priority: int = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'geoentity'

create an object of GeoAnnotation like cp = GeoAnnotation(coords=(0, 100), value=‘101st Maple Street’)

lexnlp.extract.common.annotations.law_annotation module

class lexnlp.extract.common.annotations.law_annotation.LawAnnotation(coords: Tuple[int, int], locale: str = '', name: str = '', text: str = '')

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'law'

create an object of LawAnnotation like cp = LawAnnotation(name=’name’, coords=(0, 100), text=’text text’)

lexnlp.extract.common.annotations.money_annotation module

class lexnlp.extract.common.annotations.money_annotation.MoneyAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, amount: float = None, currency: str = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'money'

create an object of MoneyAnnotation like cp = MoneyAnnotation(coords=(0, 100), value=‘10 000 USD’)

lexnlp.extract.common.annotations.percent_annotation module

class lexnlp.extract.common.annotations.percent_annotation.PercentAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, amount: float = None, sign: str = None, fraction: float = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'percent'

create an object of PercentAnnotation like cp = PercentAnnotation(coords=(0, 100), value=‘10 000 USD’)

lexnlp.extract.common.annotations.phone_annotation module

class lexnlp.extract.common.annotations.phone_annotation.PhoneAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, phone: str = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'phone'

create an object of PhoneAnnotation (Social Secutiry Number) like cp = PhoneAnnotation(coords=(0, 100), phone=’+9 915 710 42 24’)

lexnlp.extract.common.annotations.phrase_position_finder module

class lexnlp.extract.common.annotations.phrase_position_finder.PhrasePositionFinder

Bases: object

static find_phrase_in_source_text(text: str, phrases: List[str], pos_start: int = 0, pos_end: int = 0) → List[Tuple[str, int, int]]

Though phrase is taken from text, it could be changed - e.g., extra or removed spaces…

Returns a list of (phrase, phrase_start) tuples :param text: text where to find phrases ([phrases]) :param phrases: words or phrases to be found inside text :param pos_start: where to start (in source text) :param pos_end: where to stop searching :return: [(‘phrase A’, 10, 18), … ]

reg_space = regex.Regex('\\s+', flags=regex.V0)
space_symbols = {'\t', ' '}

lexnlp.extract.common.annotations.ratio_annotation module

class lexnlp.extract.common.annotations.ratio_annotation.RatioAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, left: float = None, right: float = None, ratio: float = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'ratio'

create an object of RatioAnnotation like cp = RatioAnnotation(name=’name’, coords=(0, 100), text=’text text’)

lexnlp.extract.common.annotations.regulation_annotation module

class lexnlp.extract.common.annotations.regulation_annotation.RegulationAnnotation(coords: Tuple[int, int], locale: str = 'en', name: str = '', text: str = None, source: str = '', country: str = '')

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'regulation'

create an object of RegulationAnnotation like cp = RegulationAnnotation(name=’name’, coords=(0, 100), text=’text text’)

to_dictionary_legacy() → dict

lexnlp.extract.common.annotations.ssn_annotation module

class lexnlp.extract.common.annotations.ssn_annotation.SsnAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, number: str = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'ssn'

create an object of SsnAnnotation (Social Secutiry Number) like cp = SsnAnnotation(coords=(0, 100), value=‘1234 4321 1234’)

lexnlp.extract.common.annotations.text_annotation module

class lexnlp.extract.common.annotations.text_annotation.TextAnnotation(name: str, locale: str, coords: Tuple[int, int], text: str = '')

Bases: object

It can be a CopyrightAnnotation, CourtAnnotation and so on…

Example:

cp = CopyrightAnnotation(name=’Siemens’, coords=(0, 100), text=’text text’) cp.company = ‘Siemens’ cp.year_start = 1996 s1 = cp.get_cite() # ‘/copyright/Siemens/1996’

cp.year_end = 2019 cp.locale = ‘en’ s2 = cp.get_cite() # ‘/en/copyright/Siemens/1996/2019’

get_cite() → str
get_cite_value_parts() → List[str]
get_dictionary_values() → dict
get_extracted_text(full_text: str) → str
static get_int_value(obj, def_value=None) → int
record_type = ''
static safe_cast(val, to_type, default=None)
to_dictionary() → dict

lexnlp.extract.common.annotations.trademark_annotation module

class lexnlp.extract.common.annotations.trademark_annotation.TrademarkAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, trademark: str = '')

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'trademark'

create an object of TrademarkAnnotation like cp = TrademarkAnnotation(name=’name’, coords=(0, 100), trademark=’CZ’)

lexnlp.extract.common.annotations.url_annotation module

class lexnlp.extract.common.annotations.url_annotation.UrlAnnotation(coords: Tuple[int, int], locale: str = 'en', text: str = None, url: str = None)

Bases: lexnlp.extract.common.annotations.text_annotation.TextAnnotation

get_cite_value_parts() → List[str]
get_dictionary_values() → dict
record_type = 'url'

create an object of UrlAnnotation like cp = UrlAnnotation(name=’name’, coords=(0, 100), url=’www.google.com’)

Module contents