Description
This models allows you to, given an extracter TICKER, retrieve all the parent / subsidiary /companies acquired and/or in the same group than it.
Predicted Entities
How to use
documentAssembler = nlp.DocumentAssembler()\
.setInputCol("text")\
.setOutputCol("document")
sentenceDetector = nlp.SentenceDetector()\
.setInputCols(["document"])\
.setOutputCol("sentence")
tokenizer = nlp.Tokenizer()\
.setInputCols(["sentence"])\
.setOutputCol("token")
embeddings = nlp.BertEmbeddings.pretrained("bert_embeddings_sec_bert_base","en") \
.setInputCols(["sentence", "token"]) \
.setOutputCol("embeddings")
ner_model = finance.NerModel.pretrained("finner_ticker", "en", "finance/models")\
.setInputCols(["sentence", "token", "embeddings"])\
.setOutputCol("ner")\
ner_converter = nlp.NerConverter()\
.setInputCols(["sentence", "token", "ner"])\
.setOutputCol("ner_chunk")
CM = finance.ChunkMapperModel()\
.pretrained('finmapper_wikipedia_parentcompanies_ticker','en','finance/models')\
.setInputCols(["ner_chunk"])\
.setOutputCol("mappings")
nlpPipeline = nlp.Pipeline(stages=[
documentAssembler,
sentenceDetector,
tokenizer,
embeddings,
ner_model,
ner_converter,
CM
])
text = ["""ABG is a multinational corporation that is engaged in ..."""]
test_data = spark.createDataFrame([text]).toDF("text")
model = nlpPipeline.fit(test_data)
lp = nlp.LightPipeline(model)
res= model.transform(test_data)
Results
{'mappings': ['ABSA Group Limited',
'ABSA Group Limited@https://www.wikidata.org/entity/Q58641733',
'ABSA Group Limited@ABSA Group Limited@en',
'ABSA Group Limited@https://www.wikidata.org/prop/direct/P749',
'ABSA Group Limited@is_parent_of',
'ABSA Group Limited@JOHANNESBURG STOCK EXCHANGE@en',
'ABSA Group Limited@باركليز@ar',
'ABSA Group Limited@https://www.wikidata.org/entity/Q245343'],
Model Information
Model Name: | finmapper_wikipedia_parentcompanies_ticker |
Compatibility: | Finance NLP 1.0.0+ |
License: | Licensed |
Edition: | Official |
Input Labels: | [ner_chunk] |
Output Labels: | [mappings] |
Language: | en |
Size: | 1.3 MB |
References
Wikidata