Description
This is an Entity Resolution / Entity Linking model, which is able to provide Ticker / Trading Symbols using a Company Name as an input. You can use any NER which extracts Organizations / Companies / Parties to then send the output to this Entity Linking model and get the Ticker / Trading Symbol (given the company has one).
Predicted Entities
How to use
documentAssembler = nlp.DocumentAssembler()\
.setInputCol("text")\
.setOutputCol("ner_chunk")
embeddings = nlp.UniversalSentenceEncoder.pretrained("tfhub_use", "en") \
.setInputCols("ner_chunk") \
.setOutputCol("sentence_embeddings")
resolver = finance.SentenceEntityResolverModel.pretrained("finel_names2tickers", "en", "finance/models") \
.setInputCols(["ner_chunk", "sentence_embeddings"]) \
.setOutputCol("name")\
.setDistanceFunction("EUCLIDEAN")
pipelineModel = nlp.Pipeline(
stages = [
documentAssembler,
embeddings,
resolver])
lp = LightPipeline(pipelineModel)
lp.fullAnnotate("apple")
Results
+--------+---------+----------------------------------------------+-------------------------+-----------------------------------+
| chunk| code | all_codes| resolutions | all_distances|
+--------+---------+----------------------------------------------+-------------------------+-----------------------------------+
| apple | Apple | [Apple, Apple inc., Apple INC. , Apple Inc.] |[AAPL, AAPL, AAPL, AAPL] | [0.0000, 0.1093, 0.1093, 0.1093] |
+--------+---------+----------------------------------------------+-------------------------+-----------------------------------+
Model Information
| Model Name: | finel_names2tickers |
| Type: | finance |
| Compatibility: | Finance NLP 1.0.0+ |
| License: | Licensed |
| Edition: | Official |
| Input Labels: | [sentence_embeddings] |
| Output Labels: | [company_ticker] |
| Language: | en |
| Size: | 20.3 MB |
| Case sensitive: | false |
References
https://data.world/johnsnowlabs/list-of-companies-in-nasdaq-exchanges