Is there any code to mark ”thought group" or "intonation unit" for English sentences? #13906
Unanswered
bk111
asked this question in
Help: Coding & Implementations
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I tried, but not good.
`import spacy
nlp = spacy.load("en_core_web_sm")
def get_ultra_fine_v2(text):
doc = nlp(text)
num_tokens = len(doc)
add_slash_after = [False] * num_tokens
--- 测试 ---
test_cases = [
"The man who is standing over there is my father.",
"If you want to succeed in your life, you must work hard every day.",
"English is a language that is spoken all over the world.",
"I believe that honesty is the best policy for everyone.",
"I was reading a book while my sister was playing the piano."
]
for s in test_cases:
print(f"\n[极致 2.0]: {get_ultra_fine_v2(s)}")`
Beta Was this translation helpful? Give feedback.
All reactions