Libraryless. Click here for Pure Java version (13143L/92K).
sclass AI_PronounResolver1 { S input; Pair<S, LS> pNouns; LS tok; L<ParsedWithTokens> pwt; new L<ParsedWithTokens<Pronoun<S>>> pronouns; new L<ParsedWithTokens<NounPhrase<S>>> nounPhrases; *() {} *(S *input) {} swappable bool isPronoun(S s) { ret ai_isPronoun(s); } swappable bool isNoun(S s) { ret isPrefixPlusNumberIC(s, "entity") || pNouns.b.contains(s); } run { pNouns = ai_groupAndReturnSimplestNounPhrases(input); tok = javaTokWithBrackets(pNouns.a); //print(tok); pwt = (L) pwt_fromTokenization(tok); for (ParsedWithTokens p : pwt) { S t = uncurly(optString(p!)); if (isPronoun(t)) { p.set(Pronoun(t)); pronouns.add(p); } else if (isNoun(t)) { p.set(NounPhrase(t)); nounPhrases.add(p); } } //pnl(pwt); } // what a type! ItIt<Map< ParsedWithTokens<Pronoun<S>>, ParsedWithTokens<NounPhrase<S>>>> allMappings() { ret allPartialMappings(pronouns, nounPhrases); } }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1028852 |
| Snippet name: | AI_PronounResolver1 |
| Eternal ID of this version: | #1028852/9 |
| Text MD5: | 4fcc4326b0d5502f71aa58d7cd295dbc |
| Transpilation MD5: | 91a80ca9374495ad4e45ea1237d7de33 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-07-10 19:44:17 |
| Source code size: | 1043 bytes / 39 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 469 / 818 |
| Version history: | 8 change(s) |
| Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |