Codebase list golang-github-jdkato-prose / d8ef4f3
test: add `wordpunct_tokenize` data Joseph Kato 7 years ago
2 changed file(s) with 1047 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 import json
1 import os
2
3 from nltk.tokenize import wordpunct_tokenize
4
5 if __name__ == '__main__':
6 with open(os.path.join('testdata', 'treebank_sents.json')) as d:
7 data = json.load(d)
8
9 words = []
10 for s in data:
11 words.append(wordpunct_tokenize(s))
12
13 with open(os.path.join('testdata', 'word_punct.json'), 'w') as f:
14 json.dump(words, f, indent=4)
0 [
1 [
2 "They",
3 "'",
4 "ll",
5 "save",
6 "and",
7 "invest",
8 "more",
9 "."
10 ],
11 [
12 "How",
13 "'",
14 "s",
15 "it",
16 "going",
17 "?"
18 ],
19 [
20 "abbreviations",
21 "like",
22 "M",
23 ".",
24 "D",
25 "."
26 ],
27 [
28 "and",
29 "initials",
30 "containing",
31 "periods",
32 ",",
33 "they"
34 ],
35 [
36 "hi",
37 ",",
38 "my",
39 "name",
40 "can",
41 "'",
42 "t",
43 "hello",
44 ","
45 ],
46 [
47 "Hello",
48 "World",
49 "."
50 ],
51 [
52 "My",
53 "name",
54 "is",
55 "Jonas",
56 "."
57 ],
58 [
59 "There",
60 "it",
61 "is",
62 "!"
63 ],
64 [
65 "I",
66 "found",
67 "it",
68 "."
69 ],
70 [
71 "My",
72 "name",
73 "is",
74 "Jonas",
75 "E",
76 ".",
77 "Smith",
78 "."
79 ],
80 [
81 "At",
82 "eight",
83 "o",
84 "'",
85 "clock",
86 "on",
87 "Thursday",
88 "morning",
89 "...",
90 "Arthur",
91 "didn",
92 "'",
93 "t",
94 "feel",
95 "very",
96 "good",
97 "."
98 ],
99 [
100 "Please",
101 "turn",
102 "to",
103 "p",
104 ".",
105 "55",
106 "."
107 ],
108 [
109 "Were",
110 "Jane",
111 "and",
112 "co",
113 ".",
114 "at",
115 "the",
116 "party",
117 "?"
118 ],
119 [
120 "They",
121 "closed",
122 "the",
123 "deal",
124 "with",
125 "Pitt",
126 ",",
127 "Briggs",
128 "&",
129 "Co",
130 ".",
131 "at",
132 "noon",
133 "."
134 ],
135 [
136 "Let",
137 "'",
138 "s",
139 "ask",
140 "Jane",
141 "and",
142 "co",
143 "."
144 ],
145 [
146 "They",
147 "should",
148 "know",
149 "."
150 ],
151 [
152 "They",
153 "closed",
154 "the",
155 "deal",
156 "with",
157 "Pitt",
158 ",",
159 "Briggs",
160 "&",
161 "Co",
162 "."
163 ],
164 [
165 "It",
166 "closed",
167 "yesterday",
168 "."
169 ],
170 [
171 "I",
172 "can",
173 "see",
174 "Mt",
175 "."
176 ],
177 [
178 "Fuji",
179 "from",
180 "here",
181 "."
182 ],
183 [
184 "St",
185 ".",
186 "Michael",
187 "'",
188 "s",
189 "Church",
190 "is",
191 "on",
192 "5th",
193 "st",
194 ".",
195 "near",
196 "the",
197 "light",
198 "."
199 ],
200 [
201 "That",
202 "is",
203 "JFK",
204 "Jr",
205 ".'",
206 "s",
207 "book",
208 "."
209 ],
210 [
211 "I",
212 "visited",
213 "the",
214 "U",
215 ".",
216 "S",
217 ".",
218 "A",
219 ".",
220 "last",
221 "year",
222 "."
223 ],
224 [
225 "I",
226 "live",
227 "in",
228 "the",
229 "E",
230 ".",
231 "U",
232 "."
233 ],
234 [
235 "How",
236 "about",
237 "you",
238 "?"
239 ],
240 [
241 "I",
242 "live",
243 "in",
244 "the",
245 "U",
246 ".",
247 "S",
248 ".",
249 "How",
250 "about",
251 "you",
252 "?"
253 ],
254 [
255 "I",
256 "work",
257 "for",
258 "the",
259 "U",
260 ".",
261 "S",
262 ".",
263 "Government",
264 "in",
265 "Virginia",
266 "."
267 ],
268 [
269 "I",
270 "have",
271 "lived",
272 "in",
273 "the",
274 "U",
275 ".",
276 "S",
277 ".",
278 "for",
279 "20",
280 "years",
281 "."
282 ],
283 [
284 "At",
285 "5",
286 "a",
287 ".",
288 "m",
289 ".",
290 "Mr",
291 ".",
292 "Smith",
293 "went",
294 "to",
295 "the",
296 "bank",
297 "."
298 ],
299 [
300 "He",
301 "left",
302 "the",
303 "bank",
304 "at",
305 "6",
306 "P",
307 ".",
308 "M",
309 ".",
310 "Mr",
311 ".",
312 "Smith",
313 "then",
314 "went",
315 "to",
316 "the",
317 "store",
318 "."
319 ],
320 [
321 "She",
322 "has",
323 "$",
324 "100",
325 ".",
326 "00",
327 "in",
328 "her",
329 "bag",
330 "."
331 ],
332 [
333 "She",
334 "has",
335 "$",
336 "100",
337 ".",
338 "00",
339 "."
340 ],
341 [
342 "It",
343 "is",
344 "in",
345 "her",
346 "bag",
347 "."
348 ],
349 [
350 "He",
351 "teaches",
352 "science",
353 "(",
354 "He",
355 "previously",
356 "worked",
357 "for",
358 "5",
359 "years",
360 "as",
361 "an",
362 "engineer",
363 ".)"
364 ],
365 [
366 "at",
367 "the",
368 "local",
369 "University",
370 "."
371 ],
372 [
373 "Her",
374 "email",
375 "is",
376 "Jane",
377 ".",
378 "Doe",
379 "@",
380 "example",
381 ".",
382 "com",
383 "."
384 ],
385 [
386 "I",
387 "sent",
388 "her",
389 "an",
390 "email",
391 "."
392 ],
393 [
394 "The",
395 "site",
396 "is",
397 ":",
398 "https",
399 "://",
400 "www",
401 ".",
402 "example",
403 ".",
404 "50",
405 ".",
406 "com",
407 "/",
408 "new",
409 "-",
410 "site",
411 "/",
412 "awesome_content",
413 ".",
414 "html",
415 "."
416 ],
417 [
418 "Please",
419 "check",
420 "it",
421 "out",
422 "."
423 ],
424 [
425 "She",
426 "turned",
427 "to",
428 "him",
429 ",",
430 "'",
431 "This",
432 "is",
433 "great",
434 ".'"
435 ],
436 [
437 "she",
438 "said",
439 "."
440 ],
441 [
442 "She",
443 "turned",
444 "to",
445 "him",
446 ",",
447 "\"",
448 "This",
449 "is",
450 "great",
451 ".\""
452 ],
453 [
454 "she",
455 "said",
456 "."
457 ],
458 [
459 "She",
460 "turned",
461 "to",
462 "him",
463 ",",
464 "\"",
465 "This",
466 "is",
467 "great",
468 ".\""
469 ],
470 [
471 "She",
472 "held",
473 "the",
474 "book",
475 "out",
476 "to",
477 "show",
478 "him",
479 "."
480 ],
481 [
482 "Hello",
483 "!!"
484 ],
485 [
486 "Long",
487 "time",
488 "no",
489 "see",
490 "."
491 ],
492 [
493 "Hello",
494 "??"
495 ],
496 [
497 "Who",
498 "is",
499 "there",
500 "?"
501 ],
502 [
503 "Hello",
504 "!?"
505 ],
506 [
507 "Is",
508 "that",
509 "you",
510 "?"
511 ],
512 [
513 "Hello",
514 "?!"
515 ],
516 [
517 "Is",
518 "that",
519 "you",
520 "?"
521 ],
522 [
523 "1",
524 ".)"
525 ],
526 [
527 "The",
528 "first",
529 "item",
530 "2",
531 ".)"
532 ],
533 [
534 "The",
535 "second",
536 "item"
537 ],
538 [
539 "1",
540 ".)"
541 ],
542 [
543 "The",
544 "first",
545 "item",
546 "."
547 ],
548 [
549 "2",
550 ".)"
551 ],
552 [
553 "The",
554 "second",
555 "item",
556 "."
557 ],
558 [
559 "1",
560 ")",
561 "The",
562 "first",
563 "item",
564 "2",
565 ")",
566 "The",
567 "second",
568 "item"
569 ],
570 [
571 "1",
572 ")",
573 "The",
574 "first",
575 "item",
576 "."
577 ],
578 [
579 "2",
580 ")",
581 "The",
582 "second",
583 "item",
584 "."
585 ],
586 [
587 "1",
588 "."
589 ],
590 [
591 "The",
592 "first",
593 "item",
594 "2",
595 "."
596 ],
597 [
598 "The",
599 "second",
600 "item"
601 ],
602 [
603 "1",
604 "."
605 ],
606 [
607 "The",
608 "first",
609 "item",
610 "."
611 ],
612 [
613 "2",
614 "."
615 ],
616 [
617 "The",
618 "second",
619 "item",
620 "."
621 ],
622 [
623 "\u2022",
624 "9",
625 "."
626 ],
627 [
628 "The",
629 "first",
630 "item",
631 "\u2022",
632 "10",
633 "."
634 ],
635 [
636 "The",
637 "second",
638 "item"
639 ],
640 [
641 "\u2043",
642 "9",
643 "."
644 ],
645 [
646 "The",
647 "first",
648 "item",
649 "\u2043",
650 "10",
651 "."
652 ],
653 [
654 "The",
655 "second",
656 "item"
657 ],
658 [
659 "a",
660 "."
661 ],
662 [
663 "The",
664 "first",
665 "item",
666 "b",
667 "."
668 ],
669 [
670 "The",
671 "second",
672 "item",
673 "c",
674 ".",
675 "The",
676 "third",
677 "list",
678 "item"
679 ],
680 [
681 "This",
682 "is",
683 "a",
684 "sentence",
685 "cut",
686 "off",
687 "in",
688 "the",
689 "middle",
690 "because",
691 "pdf",
692 "."
693 ],
694 [
695 "It",
696 "was",
697 "a",
698 "cold",
699 "night",
700 "in",
701 "the",
702 "city",
703 "."
704 ],
705 [
706 "features",
707 "contact",
708 "manager",
709 "events",
710 ",",
711 "activities"
712 ],
713 [
714 "You",
715 "can",
716 "find",
717 "it",
718 "at",
719 "N",
720 "\u00b0."
721 ],
722 [
723 "1026",
724 ".",
725 "253",
726 ".",
727 "553",
728 "."
729 ],
730 [
731 "That",
732 "is",
733 "where",
734 "the",
735 "treasure",
736 "is",
737 "."
738 ],
739 [
740 "She",
741 "works",
742 "at",
743 "Yahoo",
744 "!"
745 ],
746 [
747 "in",
748 "the",
749 "accounting",
750 "department",
751 "."
752 ],
753 [
754 "We",
755 "make",
756 "a",
757 "good",
758 "team",
759 ",",
760 "you",
761 "and",
762 "I",
763 "."
764 ],
765 [
766 "Did",
767 "you",
768 "see",
769 "Albert",
770 "I",
771 ".",
772 "Jones",
773 "yesterday",
774 "?"
775 ],
776 [
777 "Thoreau",
778 "argues",
779 "that",
780 "by",
781 "simplifying",
782 "one",
783 "\u2019",
784 "s",
785 "life",
786 ",",
787 "\u201c",
788 "the",
789 "laws",
790 "of",
791 "the",
792 "universe",
793 "will",
794 "appear",
795 "less",
796 "complex",
797 "."
798 ],
799 [
800 "."
801 ],
802 [
803 "."
804 ],
805 [
806 ".\u201d"
807 ],
808 [
809 "\"",
810 "Bohr",
811 "[...]",
812 "used",
813 "the",
814 "analogy",
815 "of",
816 "parallel",
817 "stairways",
818 "[...]\"",
819 "(",
820 "Smith",
821 "55",
822 ")."
823 ],
824 [
825 "If",
826 "words",
827 "are",
828 "left",
829 "off",
830 "at",
831 "the",
832 "end",
833 "of",
834 "a",
835 "sentence",
836 ",",
837 "and",
838 "that",
839 "is",
840 "all",
841 "that",
842 "is",
843 "omitted",
844 ",",
845 "indicate",
846 "the",
847 "omission",
848 "with",
849 "ellipsis",
850 "marks",
851 "(",
852 "preceded",
853 "and",
854 "followed",
855 "by",
856 "a",
857 "space",
858 ")",
859 "and",
860 "then",
861 "indicate",
862 "the",
863 "end",
864 "of",
865 "the",
866 "sentence",
867 "with",
868 "a",
869 "period",
870 "."
871 ],
872 [
873 "."
874 ],
875 [
876 "."
877 ],
878 [
879 "."
880 ],
881 [
882 "Next",
883 "sentence",
884 "."
885 ],
886 [
887 "I",
888 "never",
889 "meant",
890 "that",
891 "....",
892 "She",
893 "left",
894 "the",
895 "store",
896 "."
897 ],
898 [
899 "I",
900 "wasn",
901 "\u2019",
902 "t",
903 "really",
904 "...",
905 "well",
906 ",",
907 "what",
908 "I",
909 "mean",
910 "...",
911 "see",
912 "."
913 ],
914 [
915 "."
916 ],
917 [
918 "."
919 ],
920 [
921 "what",
922 "I",
923 "'",
924 "m",
925 "saying",
926 ",",
927 "the",
928 "thing",
929 "is",
930 "."
931 ],
932 [
933 "."
934 ],
935 [
936 "."
937 ],
938 [
939 "I",
940 "didn",
941 "\u2019",
942 "t",
943 "mean",
944 "it",
945 "."
946 ],
947 [
948 "One",
949 "further",
950 "habit",
951 "which",
952 "was",
953 "somewhat",
954 "weakened",
955 "."
956 ],
957 [
958 "."
959 ],
960 [
961 "."
962 ],
963 [
964 "was",
965 "that",
966 "of",
967 "combining",
968 "words",
969 "into",
970 "self",
971 "-",
972 "interpreting",
973 "compounds",
974 "."
975 ],
976 [
977 "."
978 ],
979 [
980 "."
981 ],
982 [
983 "."
984 ],
985 [
986 "The",
987 "practice",
988 "was",
989 "not",
990 "abandoned",
991 "."
992 ],
993 [
994 "."
995 ],
996 [
997 "."
998 ],
999 [
1000 "."
1001 ],
1002 [
1003 "Hello",
1004 "world",
1005 ".",
1006 "Today",
1007 "is",
1008 "Tuesday",
1009 ".",
1010 "Mr",
1011 "."
1012 ],
1013 [
1014 "Smith",
1015 "went",
1016 "to",
1017 "the",
1018 "store",
1019 "and",
1020 "bought",
1021 "1",
1022 ",",
1023 "000",
1024 ".",
1025 "That",
1026 "is",
1027 "a",
1028 "lot",
1029 "."
1030 ]
1031 ]