Libraryless. Click here for Pure Java version (13143L/92K).
1 | sclass AI_PronounResolver1 {
|
2 | S input; |
3 | Pair<S, LS> pNouns; |
4 | LS tok; |
5 | L<ParsedWithTokens> pwt; |
6 | new L<ParsedWithTokens<Pronoun<S>>> pronouns; |
7 | new L<ParsedWithTokens<NounPhrase<S>>> nounPhrases; |
8 | |
9 | *() {}
|
10 | *(S *input) {}
|
11 | |
12 | swappable bool isPronoun(S s) { ret ai_isPronoun(s); }
|
13 | swappable bool isNoun(S s) { ret isPrefixPlusNumberIC(s, "entity") || pNouns.b.contains(s); }
|
14 | |
15 | run {
|
16 | pNouns = ai_groupAndReturnSimplestNounPhrases(input); |
17 | tok = javaTokWithBrackets(pNouns.a); |
18 | //print(tok); |
19 | pwt = (L) pwt_fromTokenization(tok); |
20 | for (ParsedWithTokens p : pwt) {
|
21 | S t = uncurly(optString(p!)); |
22 | if (isPronoun(t)) {
|
23 | p.set(Pronoun(t)); |
24 | pronouns.add(p); |
25 | } else if (isNoun(t)) {
|
26 | p.set(NounPhrase(t)); |
27 | nounPhrases.add(p); |
28 | } |
29 | } |
30 | //pnl(pwt); |
31 | } |
32 | |
33 | // what a type! |
34 | ItIt<Map< |
35 | ParsedWithTokens<Pronoun<S>>, |
36 | ParsedWithTokens<NounPhrase<S>>>> allMappings() {
|
37 | ret allPartialMappings(pronouns, nounPhrases); |
38 | } |
39 | } |
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: | 468 / 818 |
| Version history: | 8 change(s) |
| Referenced in: | [show references] |