spacy create example object to get evaluation score

Solutions on MaxInterview for spacy create example object to get evaluation score by the best coders in the world

showing results for - "spacy create example object to get evaluation score"
Vanessa
02 Aug 2016
1Examples# Training data for a part-of-speech tagger
2doc = Doc(vocab, words=["I", "like", "stuff"])
3gold_dict = {"tags": ["NOUN", "VERB", "NOUN"]}
4example = Example.from_dict(doc, gold_dict)
5
6# Training data for an entity recognizer (option 1)
7doc = nlp("Laura flew to Silicon Valley.")
8gold_dict = {"entities": ["U-PERS", "O", "O", "B-LOC", "L-LOC"]}
9example = Example.from_dict(doc, gold_dict)
10
11# Training data for an entity recognizer (option 2)
12doc = nlp("Laura flew to Silicon Valley.")
13gold_dict = {"entities": [(0, 5, "PERSON"), (14, 28, "LOC")]}
14example = Example.from_dict(doc, gold_dict)
15
16# Training data for text categorization
17doc = nlp("I'm pretty happy about that!")
18gold_dict = {"cats": {"POSITIVE": 1.0, "NEGATIVE": 0.0}}
19example = Example.from_dict(doc, gold_dict)
20
21# Training data for an Entity Linking component (also requires entities & sentences)
22doc = nlp("Russ Cochran his reprints include EC Comics.")
23gold_dict = {"entities": [(0, 12, "PERSON")],
24             "links": {(0, 12): {"Q7381115": 1.0, "Q2146908": 0.0}},
25             "sent_starts": [1, -1, -1, -1, -1, -1, -1, -1]}
26example = Example.from_dict(doc, gold_dict)
27
similar questions