我有這樣的句子: String str = "This is a sample 123 string 456. And continue 123...";
// OR
String str = "This is another sample 123 and other words. And 123";
// I want => int result = 123;
我怎麼能只砍數123的字
我最近開始玩弄Python的Spacy庫。我想用它來找到一個句子的主題。我使用了this post中詳細描述的方法,但沒有找到整個主題。 例如: doc = nlp(u"Mr Bob Bobson enjoyed hunting and fishing")
sub_toks = [tok for tok in doc if (tok.dep_ == "nsubj")]
print(sub_to