-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from datasciencecampus/feature/doc-scoring
Topic Modelling - Redefined
- Loading branch information
Showing
15 changed files
with
590 additions
and
566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import spacy | ||
from pandas import Series | ||
|
||
|
||
def retrieve_named_entities(series: Series) -> list: | ||
"""retrieve any named entities from the series | ||
Parameters | ||
---------- | ||
series:Series | ||
A series of text strings to analyse for named entities | ||
Returns | ||
------- | ||
list[list[str]] | ||
a list of lists containing strings for each named entitity""" | ||
nlp = spacy.load("en_core_web_sm") | ||
entities = [] | ||
for doc in nlp.pipe(series): | ||
entities.append([str(ent) for ent in doc.ents]) | ||
return entities | ||
Oops, something went wrong.