Determine sentence type: Difference between revisions

m
→‎{{header|Python}}: Reinterpreted N tag as 'not punctuated'
m (→‎{{header|Python}}: Reinterpreted N tag as 'not puncuated')
m (→‎{{header|Python}}: Reinterpreted N tag as 'not punctuated')
Line 397:
tags = {'!': 'E', '?': 'Q', '.': 'S'}
 
# Joined by spaces,
sample = ' '.join([
"Hi there, how are you today?",
Line 408:
])
 
# Segmentedsegmented by punctuation,
sentences = sentenceSegments(
tags.keys()
)(sample)
 
# Tupledand withgrouped under tags.
for kv in tagGroups(tags)(sentences):
print(kv)
9,655

edits