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
import spacy | |
nlp = spacy.load('en_core_web_md') | |
nlp.get_pipe('attribute_ruler').add([[{"TEXT":"Angeltown"}]],{"LEMMA":"San Fransisco"}) | |
doc = nlp(u'I am flying to Angeltown') | |
for token in doc: | |
print(token.text, token.lemma_) |
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
import spacy | |
nlp = spacy.load('en_core_web_md') | |
doc = nlp('I joined WSP 2.5 years ago as a graduate engineer.') | |
for token in doc: | |
print(token.text, token.lemma_) |
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
import spacy | |
nlp = spacy.load('en_core_web_md') | |
text = "let's go!" | |
doc = nlp(text) | |
tok_exp = nlp.tokenizer.explain(text) | |
for t in tok_exp: | |
print(t[1], '\t', t[0]) |
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
doc = nlp("gimme that book") | |
print([w.text for w in doc]) | |
from spacy.symbols import ORTH | |
special_case = [{ORTH: "gim"}, {ORTH: "me"}] | |
nlp.tokenizer.add_special_case("gimme", special_case) | |
print([w.text for w in doc]) |
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
import spacy | |
nlp = spacy.load('en_core_web_md') | |
doc = nlp('I own a dell computer.') | |
print([token.text for token in doc]) |
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
import spacy | |
nlp = spacy.load("en_core_web_md") | |
text = "I flew to Melbourne yesterday. I was at my hotel at 5 pm." | |
doc = nlp(text) | |
for sent in doc.sents: | |
print("***") | |
print(sent.text) |
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
import math | |
while True: | |
try: | |
f1b = float(input("Enter height of the emitting panel F1, F_1b: ")) | |
f1a = float(input("Enter length of the emitting panel F1, F_1a: ")) | |
f2b = float(input("Enter height of the emitting panel F2, F_2b: ")) | |
f2a = float(input("Enter length of the emitting panel F2, F_2a: ")) | |
f3b = float(input("Enter height of the emitting panel F3, F_3b: ")) |
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
import math | |
while True: | |
try: | |
b = float(input("Enter length of the emitting panel: ")) | |
a = float(input("Enter width of the emitting panel: ")) | |
c = float(input("Enter distance between the emitting panel and the plane element: ")) | |
break | |
except: | |
print("Error! Enter a valid number") |
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
import math | |
while True: | |
try: | |
b = float(input("Enter length of the emitting panel: ")) | |
a = float(input("Enter width of the emitting panel: ")) | |
c = float(input("Enter distance between the emitting panel and the plane element: ")) | |
break | |
except: | |
print("Error! Enter a valid number") |