Open mostrecent opened 4 years ago
I also noticed that the quote attribution struggles when the speaker is not a named entity.
This sentence is processed correctly:
"We arrested John Smith on Friday", said Anna
{'id': 0, 'text': '"We arrested John Smith on Friday"', 'beginIndex': 0, 'endIndex': 34, 'beginToken': 0, 'endToken': 7, 'beginSentence': 0, 'endSentence': 0, 'speaker': 'Anna', 'canonicalSpeaker': 'Anna'}
But this one yields an unknown speaker:
"We arrested John Smith on Friday", said the police officer
{'id': 0, 'text': '"We arrested John Smith on Friday"', 'beginIndex': 0, 'endIndex': 34, 'beginToken': 0, 'endToken': 7, 'beginSentence': 0, 'endSentence': 0, 'speaker': 'Unknown', 'canonicalSpeaker': 'Unknown'}
The quote extraction has a pretty low accuracy, either I did something wrong or this should be stated as experimental in the docs. CoreNLP struggles with sentences with multiples speakers, with non-typical expression words, e.g. she sighed... instead of she said... and is frequently wrong with the canonical speaker.
The original text with some really hard parts is below. CoreNLP unfortunately even fails on the easy/unambiguous parts (below the og text is the result with errors being marked!):
"Christmas won't be Christmas without any presents," grumbled Jo, lying on the rug.
"It's so dreadful to be poor!" sighed Meg, looking down at her old dress.
"I don't think it's fair for some girls to have plenty of pretty things, and other girls nothing at all," added little Amy, with an injured sniff.
"We've got Father and Mother, and each other," said Beth contentedly from her corner.
The four young faces on which the firelight shone brightened at the cheerful words, but darkened again as Jo said sadly, "We haven't got Father, and shall not have him for a long time." She didn't say "perhaps never," but each silently added it, thinking of Father far away, where the fighting was.
Nobody spoke for a minute; then Meg said in an altered tone, "You know the reason Mother proposed not having any presents this Christmas was because it is going to be a hard winter for everyone; and she thinks we ought not to spend money for pleasure, when our men are suffering so in the army. We can't do much, but we can make our little sacrifices, and ought to do it gladly. But I am afraid I don't," and Meg shook her head, as she thought regretfully of all the pretty things she wanted.
"But I don't think the little we should spend would do any good. We've each got a dollar, and the army wouldn't be much helped by our giving that. I agree not to expect anything from Mother or you, but I do want to buy Undine and Sintran for myself. I've wanted it so long," said Jo, who was a bookworm.
"I planned to spend mine in new music," said Beth, with a little sigh, which no one heard but the hearth brush and kettle-holder.
"I shall get a nice box of Faber's drawing pencils; I really need them," said Amy decidedly.
"Mother didn't say anything about our money, and she won't wish us to give up everything. Let's each buy what we want, and have a little fun; I'm sure we work hard enough to earn it," cried Jo, examining the heels of her shoes in a gentlemanly manner.
"I know I do—teaching those tiresome children nearly all day, when I'm longing to enjoy myself at home," began Meg, in the complaining tone again.
"You don't have half such a hard time as I do," said Jo. "How would you like to be shut up for hours with a nervous, fussy old lady, who keeps you trotting, is never satisfied, and worries you till you're ready to fly out the window or cry?"
"It's naughty to fret, but I do think washing dishes and keeping things tidy is the worst work in the world. It makes me cross, and my hands get so stiff, I can't practice well at all." And Beth looked at her rough hands with a sigh that any one could hear that time.
"I don't believe any of you suffer as I do," cried Amy, "for you don't have to go to school with impertinent girls, who plague you if you don't know your lessons, and laugh at your dresses, and label your father if he isn't rich, and insult you when your nose isn't nice."
"If you mean libel, I'd say so, and not talk about labels, as if Papa was a pickle bottle," advised Jo, laughing.
"I know what I mean, and you needn't be statirical about it. It's proper to use good words, and improve your vocabilary," returned Amy, with dignity.
"Don't peck at one another, children. Don't you wish we had the money Papa lost when we were little, Jo? Dear me! How happy and good we'd be, if we had no worries!" said Meg, who could remember better times.
"You said the other day you thought we were a deal happier than the King children, for they were fighting and fretting all the time, in spite of their money."
"So I did, Beth. Well, I think we are. For though we do have to work, we make fun of ourselves, and are a pretty jolly set, as Jo would say."
"Jo does use such slang words!" observed Amy, with a reproving look at the long figure stretched on the rug.
Jo immediately sat up, put her hands in her pockets, and began to whistle.
"Don't, Jo. It's so boyish!"
"That's why I do it."
"I detest rude, unladylike girls!"
The command to get it run: