Skip to content
Snippets Groups Projects
Commit 836ad4fe authored by j2-caldwell's avatar j2-caldwell
Browse files

Upload New File

parent 48fc9805
No related branches found
No related tags found
No related merge requests found
import sys
import json
import spacy
# Load the spaCy model
#nlp = spacy.load("en_core_web_md")
nlp = spacy.load("./services/nlp_service/minimal_model3")
def process_text(text):
# Process the text with spaCy
doc = nlp(text)
# Extract entities and other relevant information
entities = [{"text": entity.text, "label": entity.label_} for entity in doc.ents]
return entities
if __name__ == "__main__":
# Read the text from the command line argument
input_text = sys.argv[1]
# Convert the input text from JSON string to dictionary
input_data = json.loads(input_text)
# Process the text
processed_data = process_text(input_data['text'])
# Print the processed data as a JSON string to stdout
print(json.dumps(processed_data))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment