lexnlp.extract.en.entities.nltk_re: Extracting companies

The lexnlp.extract.en.entities.nltk_re module contains methods that allow for the extraction of company names from text. Example statements that are covered by default in this module include:

  • Deutsche Bank Securities Inc.
  • ACME, INC.
  • Wells Fargo Bank Minnesota, National Association
  • Lexpredict LLC

The full list of current unit test cases can be found here: https://github.com/LexPredict/lexpredict-lexnlp/tree/master/lexnlp/extract/en/tests/test_entities.nltk_re

Extracting conditions

lexnlp.extract.en.entities.nltk_re.get_companies(text: str, use_article: bool = False, detail_type: bool = False, parse_name_abbr: bool = False, return_source: bool = False) → Generator

Find company names in text, optionally using the stricter article/prefix expression. :param text: :param use_article: :param detail_type: :param parse_name_abbr: :param return_source: :return:

Example

>>> import lexnlp.extract.en.entities.nltk_re

>>> text = "This is Deutsche Bank Securities Inc."
>>> print(list(lexnlp.extract.en.entities.nltk_re.get_entities.nltk_re.get_companies(text)))
[('This is Deutsche Bank Securities', 'Inc', 'Bank')]

>>> text = "This is Lexpredict LLC"
>>> print(list(lexnlp.extract.en.entities.nltk_re.get_entities.nltk_re(text)))
[('This is Lexpredict', 'LLC', None)]