Upload 17 files
Browse files- .gitattributes +3 -0
- stanford_model/LICENSE.txt +339 -0
- stanford_model/NERDemo.java +171 -0
- stanford_model/README.txt +295 -0
- stanford_model/build.xml +192 -0
- stanford_model/ner-gui.bat +1 -0
- stanford_model/ner-gui.command +2 -0
- stanford_model/ner-gui.sh +4 -0
- stanford_model/ner.bat +1 -0
- stanford_model/ner.sh +4 -0
- stanford_model/sample-conll-file.txt +9 -0
- stanford_model/sample-w-time.txt +2 -0
- stanford_model/sample.ner.txt +2 -0
- stanford_model/sample.txt +1 -0
- stanford_model/stanford-ner-4.2.0-javadoc.jar +3 -0
- stanford_model/stanford-ner-4.2.0-sources.jar +3 -0
- stanford_model/stanford-ner-4.2.0.jar +3 -0
- stanford_model/stanford-ner.jar +3 -0
.gitattributes
CHANGED
@@ -34,3 +34,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
stanford-ner.jar filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
stanford-ner.jar filter=lfs diff=lfs merge=lfs -text
|
37 |
+
stanford_model/stanford-ner-4.2.0-javadoc.jar filter=lfs diff=lfs merge=lfs -text
|
38 |
+
stanford_model/stanford-ner-4.2.0-sources.jar filter=lfs diff=lfs merge=lfs -text
|
39 |
+
stanford_model/stanford-ner-4.2.0.jar filter=lfs diff=lfs merge=lfs -text
|
stanford_model/LICENSE.txt
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
<signature of Ty Coon>, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporating your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
stanford_model/NERDemo.java
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import edu.stanford.nlp.ie.AbstractSequenceClassifier;
|
2 |
+
import edu.stanford.nlp.ie.crf.*;
|
3 |
+
import edu.stanford.nlp.io.IOUtils;
|
4 |
+
import edu.stanford.nlp.ling.CoreLabel;
|
5 |
+
import edu.stanford.nlp.ling.CoreAnnotations;
|
6 |
+
import edu.stanford.nlp.sequences.DocumentReaderAndWriter;
|
7 |
+
import edu.stanford.nlp.util.Triple;
|
8 |
+
|
9 |
+
import java.util.List;
|
10 |
+
|
11 |
+
|
12 |
+
/** This is a demo of calling CRFClassifier programmatically.
|
13 |
+
* <p>
|
14 |
+
* Usage: {@code java -mx400m -cp "*" NERDemo [serializedClassifier [fileName]] }
|
15 |
+
* <p>
|
16 |
+
* If arguments aren't specified, they default to
|
17 |
+
* classifiers/english.all.3class.distsim.crf.ser.gz and some hardcoded sample text.
|
18 |
+
* If run with arguments, it shows some of the ways to get k-best labelings and
|
19 |
+
* probabilities out with CRFClassifier. If run without arguments, it shows some of
|
20 |
+
* the alternative output formats that you can get.
|
21 |
+
* <p>
|
22 |
+
* To use CRFClassifier from the command line:
|
23 |
+
* </p><blockquote>
|
24 |
+
* {@code java -mx400m edu.stanford.nlp.ie.crf.CRFClassifier -loadClassifier [classifier] -textFile [file] }
|
25 |
+
* </blockquote><p>
|
26 |
+
* Or if the file is already tokenized and one word per line, perhaps in
|
27 |
+
* a tab-separated value format with extra columns for part-of-speech tag,
|
28 |
+
* etc., use the version below (note the 's' instead of the 'x'):
|
29 |
+
* </p><blockquote>
|
30 |
+
* {@code java -mx400m edu.stanford.nlp.ie.crf.CRFClassifier -loadClassifier [classifier] -testFile [file] }
|
31 |
+
* </blockquote>
|
32 |
+
*
|
33 |
+
* @author Jenny Finkel
|
34 |
+
* @author Christopher Manning
|
35 |
+
*/
|
36 |
+
|
37 |
+
public class NERDemo {
|
38 |
+
|
39 |
+
public static void main(String[] args) throws Exception {
|
40 |
+
|
41 |
+
String serializedClassifier = "classifiers/english.all.3class.distsim.crf.ser.gz";
|
42 |
+
|
43 |
+
if (args.length > 0) {
|
44 |
+
serializedClassifier = args[0];
|
45 |
+
}
|
46 |
+
|
47 |
+
AbstractSequenceClassifier<CoreLabel> classifier = CRFClassifier.getClassifier(serializedClassifier);
|
48 |
+
|
49 |
+
/* For either a file to annotate or for the hardcoded text example, this
|
50 |
+
demo file shows several ways to process the input, for teaching purposes.
|
51 |
+
*/
|
52 |
+
|
53 |
+
if (args.length > 1) {
|
54 |
+
|
55 |
+
/* For the file, it shows (1) how to run NER on a String, (2) how
|
56 |
+
to get the entities in the String with character offsets, and
|
57 |
+
(3) how to run NER on a whole file (without loading it into a String).
|
58 |
+
*/
|
59 |
+
|
60 |
+
String fileContents = IOUtils.slurpFile(args[1]);
|
61 |
+
List<List<CoreLabel>> out = classifier.classify(fileContents);
|
62 |
+
for (List<CoreLabel> sentence : out) {
|
63 |
+
for (CoreLabel word : sentence) {
|
64 |
+
System.out.print(word.word() + '/' + word.get(CoreAnnotations.AnswerAnnotation.class) + ' ');
|
65 |
+
}
|
66 |
+
System.out.println();
|
67 |
+
}
|
68 |
+
|
69 |
+
System.out.println("---");
|
70 |
+
out = classifier.classifyFile(args[1]);
|
71 |
+
for (List<CoreLabel> sentence : out) {
|
72 |
+
for (CoreLabel word : sentence) {
|
73 |
+
System.out.print(word.word() + '/' + word.get(CoreAnnotations.AnswerAnnotation.class) + ' ');
|
74 |
+
}
|
75 |
+
System.out.println();
|
76 |
+
}
|
77 |
+
|
78 |
+
System.out.println("---");
|
79 |
+
List<Triple<String, Integer, Integer>> list = classifier.classifyToCharacterOffsets(fileContents);
|
80 |
+
for (Triple<String, Integer, Integer> item : list) {
|
81 |
+
System.out.println(item.first() + ": " + fileContents.substring(item.second(), item.third()));
|
82 |
+
}
|
83 |
+
System.out.println("---");
|
84 |
+
System.out.println("Ten best entity labelings");
|
85 |
+
DocumentReaderAndWriter<CoreLabel> readerAndWriter = classifier.makePlainTextReaderAndWriter();
|
86 |
+
classifier.classifyAndWriteAnswersKBest(args[1], 10, readerAndWriter);
|
87 |
+
|
88 |
+
System.out.println("---");
|
89 |
+
System.out.println("Per-token marginalized probabilities");
|
90 |
+
classifier.printProbs(args[1], readerAndWriter);
|
91 |
+
|
92 |
+
// -- This code prints out the first order (token pair) clique probabilities.
|
93 |
+
// -- But that output is a bit overwhelming, so we leave it commented out by default.
|
94 |
+
// System.out.println("---");
|
95 |
+
// System.out.println("First Order Clique Probabilities");
|
96 |
+
// ((CRFClassifier) classifier).printFirstOrderProbs(args[1], readerAndWriter);
|
97 |
+
|
98 |
+
} else {
|
99 |
+
|
100 |
+
/* For the hard-coded String, it shows how to run it on a single
|
101 |
+
sentence, and how to do this and produce several formats, including
|
102 |
+
slash tags and an inline XML output format. It also shows the full
|
103 |
+
contents of the {@code CoreLabel}s that are constructed by the
|
104 |
+
classifier. And it shows getting out the probabilities of different
|
105 |
+
assignments and an n-best list of classifications with probabilities.
|
106 |
+
*/
|
107 |
+
|
108 |
+
String[] example = {"Good afternoon Rajat Raina, how are you today?",
|
109 |
+
"I go to school at Stanford University, which is located in California." };
|
110 |
+
for (String str : example) {
|
111 |
+
System.out.println(classifier.classifyToString(str));
|
112 |
+
}
|
113 |
+
System.out.println("---");
|
114 |
+
|
115 |
+
for (String str : example) {
|
116 |
+
// This one puts in spaces and newlines between tokens, so just print not println.
|
117 |
+
System.out.print(classifier.classifyToString(str, "slashTags", false));
|
118 |
+
}
|
119 |
+
System.out.println("---");
|
120 |
+
|
121 |
+
for (String str : example) {
|
122 |
+
// This one is best for dealing with the output as a TSV (tab-separated column) file.
|
123 |
+
// The first column gives entities, the second their classes, and the third the remaining text in a document
|
124 |
+
System.out.print(classifier.classifyToString(str, "tabbedEntities", false));
|
125 |
+
}
|
126 |
+
System.out.println("---");
|
127 |
+
|
128 |
+
for (String str : example) {
|
129 |
+
System.out.println(classifier.classifyWithInlineXML(str));
|
130 |
+
}
|
131 |
+
System.out.println("---");
|
132 |
+
|
133 |
+
for (String str : example) {
|
134 |
+
System.out.println(classifier.classifyToString(str, "xml", true));
|
135 |
+
}
|
136 |
+
System.out.println("---");
|
137 |
+
|
138 |
+
for (String str : example) {
|
139 |
+
System.out.print(classifier.classifyToString(str, "tsv", false));
|
140 |
+
}
|
141 |
+
System.out.println("---");
|
142 |
+
|
143 |
+
// This gets out entities with character offsets
|
144 |
+
int j = 0;
|
145 |
+
for (String str : example) {
|
146 |
+
j++;
|
147 |
+
List<Triple<String,Integer,Integer>> triples = classifier.classifyToCharacterOffsets(str);
|
148 |
+
for (Triple<String,Integer,Integer> trip : triples) {
|
149 |
+
System.out.printf("%s over character offsets [%d, %d) in sentence %d.%n",
|
150 |
+
trip.first(), trip.second(), trip.third, j);
|
151 |
+
}
|
152 |
+
}
|
153 |
+
System.out.println("---");
|
154 |
+
|
155 |
+
// This prints out all the details of what is stored for each token
|
156 |
+
int i=0;
|
157 |
+
for (String str : example) {
|
158 |
+
for (List<CoreLabel> lcl : classifier.classify(str)) {
|
159 |
+
for (CoreLabel cl : lcl) {
|
160 |
+
System.out.print(i++ + ": ");
|
161 |
+
System.out.println(cl.toShorterString());
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
System.out.println("---");
|
167 |
+
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
}
|
stanford_model/README.txt
ADDED
@@ -0,0 +1,295 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Stanford NER - v4.2.0 - 2020-11-17
|
2 |
+
----------------------------------------------
|
3 |
+
|
4 |
+
This package provides a high-performance machine learning based named
|
5 |
+
entity recognition system, including facilities to train models from
|
6 |
+
supervised training data and pre-trained models for English.
|
7 |
+
|
8 |
+
(c) 2002-2020. The Board of Trustees of The Leland
|
9 |
+
Stanford Junior University. All Rights Reserved.
|
10 |
+
|
11 |
+
Original CRF code by Jenny Finkel.
|
12 |
+
Additional modules, features, internationalization, compaction, and
|
13 |
+
support code by Christopher Manning, Dan Klein, Christopher Cox, Huy Nguyen
|
14 |
+
Shipra Dingare, Anna Rafferty, and John Bauer.
|
15 |
+
This release prepared by Jason Bolton.
|
16 |
+
|
17 |
+
LICENSE
|
18 |
+
|
19 |
+
The software is licensed under the full GPL v2+. Please see the file LICENCE.txt
|
20 |
+
|
21 |
+
For more information, bug reports, and fixes, contact:
|
22 |
+
Christopher Manning
|
23 |
+
Dept of Computer Science, Gates 2A
|
24 |
+
Stanford CA 94305-9020
|
25 |
+
USA
|
26 |
+
java-nlp-support@lists.stanford.edu
|
27 |
+
https://nlp.stanford.edu/software/CRF-NER.html
|
28 |
+
|
29 |
+
CONTACT
|
30 |
+
|
31 |
+
For questions about this distribution, please contact Stanford's JavaNLP group
|
32 |
+
at java-nlp-user@lists.stanford.edu. We provide assistance on a best-effort
|
33 |
+
basis.
|
34 |
+
|
35 |
+
TUTORIAL
|
36 |
+
|
37 |
+
Quickstart guidelines, primarily for end users who wish to use the included NER
|
38 |
+
models, are below. For further instructions on training your own NER model,
|
39 |
+
go to https://nlp.stanford.edu/software/crf-faq.html.
|
40 |
+
|
41 |
+
INCLUDED SERIALIZED MODELS / TRAINING DATA
|
42 |
+
|
43 |
+
The basic included serialized model is a 3 class NER tagger that can
|
44 |
+
label: PERSON, ORGANIZATION, and LOCATION entities. It is included as
|
45 |
+
english.all.3class.distsim.crf.ser.gz. It is trained on data from
|
46 |
+
CoNLL, MUC6, MUC7, ACE, OntoNotes, and Wikipedia.
|
47 |
+
Because this model is trained on both US
|
48 |
+
and UK newswire, it is fairly robust across the two domains.
|
49 |
+
|
50 |
+
We have also included a 4 class NER tagger trained on the CoNLL 2003
|
51 |
+
Shared Task training data that labels for PERSON, ORGANIZATION,
|
52 |
+
LOCATION, and MISC. It is named
|
53 |
+
english.conll.4class.distsim.crf.ser.gz .
|
54 |
+
|
55 |
+
A third model is trained only on data from MUC and
|
56 |
+
distinguishes between 7 different classes:
|
57 |
+
english.muc.7class.distsim.crf.ser.gz.
|
58 |
+
|
59 |
+
All of the serialized classifiers come in two versions, one trained to
|
60 |
+
basically expected standard written English capitalization, and the other
|
61 |
+
to ignore capitalization information. The case-insensitive versions
|
62 |
+
of the three models available on the Stanford NER webpage.
|
63 |
+
These models use a distributional similarity lexicon to improve performance
|
64 |
+
(by between 1.5%-3% F-measure). The distributional similarity features
|
65 |
+
make the models perform substantially better, but they require rather
|
66 |
+
more memory. The distsim models are included in the release package.
|
67 |
+
The nodistsim versions of the same models may be available on the
|
68 |
+
Stanford NER webpage.
|
69 |
+
|
70 |
+
Finally, we have models for other languages, including two German models,
|
71 |
+
a Chinese model, and a Spanish model. The files for these models can be
|
72 |
+
found at:
|
73 |
+
|
74 |
+
http://nlp.stanford.edu/software/CRF-NER.html
|
75 |
+
|
76 |
+
|
77 |
+
QUICKSTART INSTRUCTIONS
|
78 |
+
|
79 |
+
This NER system requires Java 1.8 or later.
|
80 |
+
|
81 |
+
Providing java is on your PATH, you should be able to run an NER GUI
|
82 |
+
demonstration by just clicking. It might work to double-click on the
|
83 |
+
stanford-ner.jar archive but this may well fail as the operating system
|
84 |
+
does not give Java enough memory for our NER system, so it is safer to
|
85 |
+
instead double click on the ner-gui.bat icon (Windows) or ner-gui.sh
|
86 |
+
(Linux/Unix/MacOSX). Then, using the top option from the Classifier
|
87 |
+
menu, load a CRF classifier from the classifiers directory of the
|
88 |
+
distribution. You can then `either load a text file or web page from
|
89 |
+
the File menu, or decide to use the default text in the window. Finally,
|
90 |
+
you can now named entity tag the text by pressing the Run NER button.
|
91 |
+
|
92 |
+
From a command line, you need to have java on your PATH and the
|
93 |
+
stanford-ner.jar file and the lib directory in your CLASSPATH. (The way of doing this depends on
|
94 |
+
your OS/shell.) The supplied ner.bat and ner.sh should work to allow
|
95 |
+
you to tag a single file. For example, for Windows:
|
96 |
+
|
97 |
+
ner file
|
98 |
+
|
99 |
+
Or on Unix/Linux you should be able to parse the test file in the distribution
|
100 |
+
directory with the command:
|
101 |
+
|
102 |
+
java -mx600m -cp stanford-ner.jar:lib/* edu.stanford.nlp.ie.crf.CRFClassifier -loadClassifier classifiers/english.all.3class.distsim.crf.ser.gz -textFile sample.txt
|
103 |
+
|
104 |
+
Here's an output option that will print out entities and their class to
|
105 |
+
the first two columns of a tab-separated columns output file:
|
106 |
+
|
107 |
+
java -mx600m -cp stanford-ner.jar:lib/* edu.stanford.nlp.ie.crf.CRFClassifier -loadClassifier classifiers/english.all.3class.distsim.crf.ser.gz -outputFormat tabbedEntities -textFile sample.txt > sample.tsv
|
108 |
+
|
109 |
+
When run from a jar file, you also have the option of using a serialized
|
110 |
+
classifier contained in the jar file.
|
111 |
+
|
112 |
+
USING FULL STANFORD CORENLP NER FUNCTIONALITY
|
113 |
+
|
114 |
+
This standalone distribution also allows access to the full NER
|
115 |
+
capabilities of the Stanford CoreNLP pipeline. These capabilities
|
116 |
+
can be accessed via the NERClassifierCombiner class.
|
117 |
+
NERClassifierCombiner allows for multiple CRFs to be used together,
|
118 |
+
and has options for recognizing numeric sequence patterns and time
|
119 |
+
patterns with the rule-based NER of SUTime.
|
120 |
+
|
121 |
+
Suppose one combines three CRF's CRF-1,CRF-2, and CRF-3 with the
|
122 |
+
NERClassifierCombiner. When the NERClassiferCombiner runs, it will
|
123 |
+
first apply the NER tags of CRF-1 to the text, then it will apply
|
124 |
+
CRF-2's NER tags to any tokens not tagged by CRF-1 and so on. If
|
125 |
+
the option ner.combinationMode is set to NORMAL (default), any label
|
126 |
+
applied by CRF-1 cannot be applied by subsequent CRF's. For instance
|
127 |
+
if CRF-1 applies the LOCATION tag, no other CRF's LOCATION tag will be
|
128 |
+
used. If ner.combinationMode is set to HIGH_RECALL, this limitation
|
129 |
+
will be deactivated.
|
130 |
+
|
131 |
+
To use NERClassifierCombiner at the command-line, the jars in lib
|
132 |
+
and stanford-ner.jar must be in the CLASSPATH. Here is an example command:
|
133 |
+
|
134 |
+
java -mx2g edu.stanford.nlp.ie.NERClassifierCombiner -ner.model \
|
135 |
+
classifiers/english.conll.4class.distsim.crf.ser.gz,classifiers/english.muc.7class.distsim.crf.ser.gz \
|
136 |
+
-ner.useSUTime false -textFile sample-w-time.txt
|
137 |
+
|
138 |
+
Let's break this down a bit. The flag "-ner.model" should be followed by a
|
139 |
+
list of CRF's to be combined by the NERClassifierCombiner. Some serialized
|
140 |
+
CRF's are provided in the classifiers directory. In this example the CRF's
|
141 |
+
trained on the CONLL 4 class data and the MUC 7 class data are being combined.
|
142 |
+
|
143 |
+
When the flag "-ner.useSUTime" is followed by "false", SUTime is shut off. You should
|
144 |
+
note that when the "false" is omitted, the text "4 days ago" suddenly is
|
145 |
+
tagged with DATE. These are the kinds of phrases SUTime can identify.
|
146 |
+
|
147 |
+
NERClassifierCombiner can be run on different types of input as well. Here is
|
148 |
+
an example which is run on CONLL style input:
|
149 |
+
|
150 |
+
java -mx2g edu.stanford.nlp.ie.NERClassifierCombiner -ner.model \
|
151 |
+
classifiers/english.conll.4class.distsim.crf.ser.gz,classifiers/english.muc.7class.distsim.crf.ser.gz \
|
152 |
+
-map word=0,answer=1 -testFile sample-conll-file.txt
|
153 |
+
|
154 |
+
It is crucial to include the "-map word=0,answer=1" , which is specifying that
|
155 |
+
the input test file has the words in the first column and the answer labels
|
156 |
+
in the second column.
|
157 |
+
|
158 |
+
It is also possible to serialize and load an NERClassifierCombiner.
|
159 |
+
|
160 |
+
This command loads the three sample crfs with combinationMode=HIGH_RECALL
|
161 |
+
and SUTime=false, and dumps them to a file named
|
162 |
+
test_serialized_ncc.ncc.ser.gz
|
163 |
+
|
164 |
+
java -mx2g edu.stanford.nlp.ie.NERClassifierCombiner -ner.model \
|
165 |
+
classifiers/english.conll.4class.distsim.crf.ser.gz,classifiers/english.muc.7class.distsim.crf.ser.gz,\
|
166 |
+
classifiers/english.all.3class.distsim.crf.ser.gz -ner.useSUTime false \
|
167 |
+
-ner.combinationMode HIGH_RECALL -serializeTo test.serialized.ncc.ncc.ser.gz
|
168 |
+
|
169 |
+
An example serialized NERClassifierCombiner with these settings is supplied in
|
170 |
+
the classifiers directory. Here is an example of loading that classifier and
|
171 |
+
running it on the sample CONLL data:
|
172 |
+
|
173 |
+
java -mx2g edu.stanford.nlp.ie.NERClassifierCombiner -loadClassifier \
|
174 |
+
classifiers/example.serialized.ncc.ncc.ser.gz -map word=0,answer=1 \
|
175 |
+
-testFile sample-conll-file.txt
|
176 |
+
|
177 |
+
For a more exhaustive description of NERClassifierCombiner go to
|
178 |
+
http://nlp.stanford.edu/software/ncc-faq.html
|
179 |
+
|
180 |
+
PROGRAMMATIC USE
|
181 |
+
|
182 |
+
The NERDemo file illustrates a couple of ways of calling the system
|
183 |
+
programatically. You should get the same results from
|
184 |
+
|
185 |
+
java -cp stanford-ner.jar:lib/*:. -mx300m NERDemo classifiers/english.all.3class.distsim.crf.ser.gz sample.txt
|
186 |
+
|
187 |
+
as from using CRFClassifier. For more information on API calls, look in
|
188 |
+
the enclosed javadoc directory: load index.html in a browser and look
|
189 |
+
first at the edu.stanford.nlp.ie.crf package and CRFClassifier class.
|
190 |
+
If you wish to train your own NER systems, look also at the
|
191 |
+
edu.stanford.nlp.ie package NERFeatureFactory class.
|
192 |
+
|
193 |
+
|
194 |
+
SERVER VERSION
|
195 |
+
|
196 |
+
The NER code may also be run as a server listening on a socket:
|
197 |
+
|
198 |
+
java -mx1000m -cp stanford-ner.jar:lib/* edu.stanford.nlp.ie.NERServer 1234
|
199 |
+
|
200 |
+
You can specify which model to load with flags, either one on disk:
|
201 |
+
|
202 |
+
java -mx1000m -cp stanford-ner.jar:lib/* edu.stanford.nlp.ie.NERServer -loadClassifier classifiers/all.3class.crf.ser.gz 1234
|
203 |
+
|
204 |
+
Or if you have put a model inside the jar file, as a resource under, say, models:
|
205 |
+
|
206 |
+
java -mx1000m -cp stanford-ner.jar:lib/* edu.stanford.nlp.ie.NERServer -loadClassifier models/all.3class.crf.ser.gz 1234
|
207 |
+
|
208 |
+
|
209 |
+
RUNNING CLASSIFIERS FROM INSIDE A JAR FILE
|
210 |
+
|
211 |
+
The software can run any serialized classifier from within a jar file by
|
212 |
+
following the -loadClassifier flag by some resource available within a
|
213 |
+
jar file on the CLASSPATH. An end user can make
|
214 |
+
their own jar files with the desired NER models contained inside.
|
215 |
+
This allows single jar file deployment.
|
216 |
+
|
217 |
+
|
218 |
+
PERFORMANCE GUIDELINES
|
219 |
+
|
220 |
+
Performance depends on many factors. Speed and memory use depend on
|
221 |
+
hardware, operating system, and JVM. Accuracy depends on the data
|
222 |
+
tested on. Nevertheless, in the belief that something is better than
|
223 |
+
nothing, here are some statistics from one machine on one test set, in
|
224 |
+
semi-realistic conditions (where the test data is somewhat varied).
|
225 |
+
|
226 |
+
ner-eng-ie.crf-3-all2006-distsim.ser.gz (older version of ner-eng-ie.crf-3-all2008-distsim.ser.gz)
|
227 |
+
Memory: 320MB (on a 32 bit machine)
|
228 |
+
PERSON ORGANIZATION LOCATION
|
229 |
+
91.88 82.91 88.21
|
230 |
+
|
231 |
+
|
232 |
+
--------------------
|
233 |
+
CHANGES
|
234 |
+
--------------------
|
235 |
+
|
236 |
+
2020-11-17 4.2.0 Update for compatibility
|
237 |
+
|
238 |
+
2020-05-10 4.0.0 Update to UDv2.0 tokenization
|
239 |
+
|
240 |
+
2018-10-16 3.9.2 Update for compatibility
|
241 |
+
|
242 |
+
2018-02-27 3.9.1 KBP ner models for Chinese and Spanish
|
243 |
+
|
244 |
+
2017-06-09 3.8.0 Updated for compatibility
|
245 |
+
|
246 |
+
2016-10-31 3.7.0 Improved Chinese NER
|
247 |
+
|
248 |
+
2015-12-09 3.6.0 Updated for compatibility
|
249 |
+
|
250 |
+
2015-04-20 3.5.2 synch standalone and CoreNLP functionality
|
251 |
+
|
252 |
+
2015-01-29 3.5.1 Substantial accuracy improvements
|
253 |
+
|
254 |
+
2014-10-26 3.5.0 Upgrade to Java 1.8
|
255 |
+
|
256 |
+
2014-08-27 3.4.1 Add Spanish models
|
257 |
+
|
258 |
+
2014-06-16 3.4 Fix serialization bug
|
259 |
+
|
260 |
+
2014-01-04 3.3.1 Bugfix release
|
261 |
+
|
262 |
+
2013-11-12 3.3.0 Update for compatibility
|
263 |
+
|
264 |
+
2013-11-12 3.3.0 Update for compatibility
|
265 |
+
|
266 |
+
2013-06-19 3.2.0 Improve handling of line-by-line input
|
267 |
+
|
268 |
+
2013-04-04 1.2.8 nthreads option
|
269 |
+
|
270 |
+
2012-11-11 1.2.7 Improved English 3 class model by including
|
271 |
+
data from Wikipedia, release Chinese model
|
272 |
+
|
273 |
+
2012-07-09 1.2.6 Minor bug fixes
|
274 |
+
|
275 |
+
2012-05-22 1.2.5 Fix encoding issue
|
276 |
+
|
277 |
+
2012-04-07 1.2.4 Caseless version of English models supported
|
278 |
+
|
279 |
+
2012-01-06 1.2.3 Minor bug fixes
|
280 |
+
|
281 |
+
2011-09-14 1.2.2 Improved thread safety
|
282 |
+
|
283 |
+
2011-06-19 1.2.1 Models reduced in size but on average improved
|
284 |
+
in accuracy (improved distsim clusters)
|
285 |
+
|
286 |
+
2011-05-16 1.2 Normal download includes 3, 4, and 7
|
287 |
+
class models. Updated for compatibility
|
288 |
+
with other software releases.
|
289 |
+
|
290 |
+
2009-01-16 1.1.1 Minor bug and usability fixes, changed API
|
291 |
+
|
292 |
+
2008-05-07 1.1 Additional feature flags, various code updates
|
293 |
+
|
294 |
+
2006-09-18 1.0 Initial release
|
295 |
+
|
stanford_model/build.xml
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- build.xml file for ant for JavaNLP -->
|
2 |
+
|
3 |
+
<!-- Before using this, unjar the sources' jar file into the src/ directory! -->
|
4 |
+
|
5 |
+
<!-- A "project" describes a set of targets that may be requested
|
6 |
+
when Ant is executed. The "default" attribute defines the
|
7 |
+
target which is executed if no specific target is requested,
|
8 |
+
and the "basedir" attribute defines the current working directory
|
9 |
+
from which Ant executes the requested task. This is normally
|
10 |
+
set to the current working directory.
|
11 |
+
-->
|
12 |
+
|
13 |
+
<project name="JavaNLP" default="compile" basedir=".">
|
14 |
+
|
15 |
+
<property name="build.home" value="${basedir}/classes"/>
|
16 |
+
<property name="build.tests" value="${basedir}/classes"/>
|
17 |
+
<property name="docs.home" value="${basedir}/docs"/>
|
18 |
+
<property name="src.home" value="${basedir}/src"/>
|
19 |
+
<property name="javadoc.home" value="${basedir}/javadoc"/>
|
20 |
+
|
21 |
+
|
22 |
+
<!-- ==================== Compilation Control Options ==================== -->
|
23 |
+
|
24 |
+
<!--
|
25 |
+
|
26 |
+
These properties control option settings on the Javac compiler when it
|
27 |
+
is invoked using the <javac> task.
|
28 |
+
|
29 |
+
compile.debug Should compilation include the debug option?
|
30 |
+
|
31 |
+
compile.deprecation Should compilation include the deprecation option?
|
32 |
+
|
33 |
+
compile.optimize Should compilation include the optimize option?
|
34 |
+
|
35 |
+
compile.source Source version compatibility
|
36 |
+
|
37 |
+
compile.target Target class version compatibility
|
38 |
+
|
39 |
+
-->
|
40 |
+
|
41 |
+
<property name="compile.debug" value="true"/>
|
42 |
+
<property name="compile.deprecation" value="false"/>
|
43 |
+
<property name="compile.optimize" value="true"/>
|
44 |
+
<property name="compile.source" value="1.8" />
|
45 |
+
<property name="compile.target" value="1.8" />
|
46 |
+
<property name="compile.encoding" value="utf-8" />
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
<!-- ==================== All Target ====================================== -->
|
52 |
+
|
53 |
+
<!--
|
54 |
+
|
55 |
+
The "all" target is a shortcut for running the "clean" target followed
|
56 |
+
by the "compile" target, to force a complete recompile.
|
57 |
+
|
58 |
+
-->
|
59 |
+
|
60 |
+
<target name="all" depends="clean,compile"
|
61 |
+
description="Clean build and dist directories, then compile"/>
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
<!-- ==================== Clean Target ==================================== -->
|
66 |
+
|
67 |
+
<!--
|
68 |
+
|
69 |
+
The "clean" target deletes any previous "build" and "dist" directory,
|
70 |
+
so that you can be ensured the application can be built from scratch.
|
71 |
+
|
72 |
+
-->
|
73 |
+
|
74 |
+
<target name="clean" description="Delete old classes">
|
75 |
+
<delete dir="${build.home}/edu"/>
|
76 |
+
</target>
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
<!-- ==================== Compile Target ================================== -->
|
81 |
+
|
82 |
+
<!--
|
83 |
+
|
84 |
+
The "compile" target transforms source files (from your "src" directory)
|
85 |
+
into object files in the appropriate location in the build directory.
|
86 |
+
This example assumes that you will be including your classes in an
|
87 |
+
unpacked directory hierarchy under "/WEB-INF/classes".
|
88 |
+
|
89 |
+
-->
|
90 |
+
|
91 |
+
<target name="compile" depends="prepare"
|
92 |
+
description="Compile Java sources">
|
93 |
+
|
94 |
+
<!-- Compile Java classes as necessary -->
|
95 |
+
<mkdir dir="${build.home}"/>
|
96 |
+
<javac srcdir="${src.home}"
|
97 |
+
destdir="${build.home}"
|
98 |
+
debug="${compile.debug}"
|
99 |
+
encoding="${compile.encoding}"
|
100 |
+
deprecation="${compile.deprecation}"
|
101 |
+
optimize="${compile.optimize}"
|
102 |
+
source="${compile.source}"
|
103 |
+
target="${compile.target}"
|
104 |
+
includeantruntime="false">
|
105 |
+
<compilerarg value="-Xmaxerrs"/>
|
106 |
+
<compilerarg value="20"/>
|
107 |
+
<classpath>
|
108 |
+
<fileset dir="${basedir}/lib">
|
109 |
+
<include name="*.jar"/>
|
110 |
+
<exclude name="javanlp*"/>
|
111 |
+
</fileset>
|
112 |
+
</classpath>
|
113 |
+
<!-- <compilerarg value="-Xlint"/> -->
|
114 |
+
</javac>
|
115 |
+
|
116 |
+
<!-- Copy application resources -->
|
117 |
+
<!--
|
118 |
+
<copy todir="${build.home}/WEB-INF/classes">
|
119 |
+
<fileset dir="${src.home}" excludes="**/*.java"/>
|
120 |
+
</copy>
|
121 |
+
-->
|
122 |
+
|
123 |
+
</target>
|
124 |
+
|
125 |
+
|
126 |
+
<!-- ==================== Javadoc Target ================================== -->
|
127 |
+
|
128 |
+
<!--
|
129 |
+
|
130 |
+
The "javadoc" target creates Javadoc API documentation for the Java
|
131 |
+
classes included in your application. Normally, this is only required
|
132 |
+
when preparing a distribution release, but is available as a separate
|
133 |
+
target in case the developer wants to create Javadocs independently.
|
134 |
+
|
135 |
+
-->
|
136 |
+
|
137 |
+
<target name="javadoc" depends="compile"
|
138 |
+
description="Create Javadoc API documentation">
|
139 |
+
|
140 |
+
<mkdir dir="${javadoc.home}"/>
|
141 |
+
<javadoc sourcepath="${src.home}"
|
142 |
+
destdir="${javadoc.home}"
|
143 |
+
maxmemory="1g"
|
144 |
+
author="true"
|
145 |
+
source="${compile.source}"
|
146 |
+
overview="${src.home}/edu/stanford/nlp/overview.html"
|
147 |
+
doctitle="Stanford JavaNLP API Documentation"
|
148 |
+
windowtitle="Stanford JavaNLP API"
|
149 |
+
encoding="${compile.encoding}"
|
150 |
+
docencoding="${compile.encoding}"
|
151 |
+
charset="${compile.encoding}"
|
152 |
+
packagenames="*">
|
153 |
+
<!-- Allow @generated, @modifiable and @ordered tags -->
|
154 |
+
<tag name="generated" scope="all" description="Generated" />
|
155 |
+
<tag name="modifiable" scope="all" description="Modifiable" />
|
156 |
+
<tag name="ordered" scope="all" description="Ordered" />
|
157 |
+
<!-- Depends on lib and classes folders -->
|
158 |
+
<classpath>
|
159 |
+
<fileset dir="${basedir}/lib">
|
160 |
+
<include name="*.jar"/>
|
161 |
+
<exclude name="javanlp*"/>
|
162 |
+
</fileset>
|
163 |
+
<pathelement path="${build.home}" />
|
164 |
+
</classpath>
|
165 |
+
<bottom><![CDATA[<font size="2"><a href="https://nlp.stanford.edu" target="_top">Stanford NLP Group</a></font>]]></bottom>
|
166 |
+
<link href="https://docs.oracle.com/javase/8/docs/api/"/>
|
167 |
+
</javadoc>
|
168 |
+
|
169 |
+
</target>
|
170 |
+
|
171 |
+
|
172 |
+
<!-- ==================== Prepare Target ================================== -->
|
173 |
+
|
174 |
+
<!--
|
175 |
+
|
176 |
+
The "prepare" target is used to create the "build" destination directory,
|
177 |
+
and copy the static contents of your web application to it. If you need
|
178 |
+
to copy static files from external dependencies, you can customize the
|
179 |
+
contents of this task.
|
180 |
+
|
181 |
+
Normally, this task is executed indirectly when needed.
|
182 |
+
|
183 |
+
-->
|
184 |
+
|
185 |
+
<target name="prepare">
|
186 |
+
|
187 |
+
<!-- Create build directories as needed -->
|
188 |
+
<mkdir dir="${build.home}"/>
|
189 |
+
|
190 |
+
</target>
|
191 |
+
|
192 |
+
</project>
|
stanford_model/ner-gui.bat
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
java -mx1500m -cp "stanford-ner.jar;lib/*" edu.stanford.nlp.ie.crf.NERGUI
|
stanford_model/ner-gui.command
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
java -mx500m -cp `dirname $0`/stanford-ner.jar:`dirname $0`/lib/* edu.stanford.nlp.ie.crf.NERGUI
|
stanford_model/ner-gui.sh
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
scriptdir=`dirname $0`
|
3 |
+
|
4 |
+
java -mx700m -cp "$scriptdir/stanford-ner.jar:lib/*" edu.stanford.nlp.ie.crf.NERGUI
|
stanford_model/ner.bat
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
java -mx1000m -cp stanford-ner.jar;lib/* edu.stanford.nlp.ie.crf.CRFClassifier -loadClassifier classifiers\english.all.3class.distsim.crf.ser.gz -textFile %1
|
stanford_model/ner.sh
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
scriptdir=`dirname $0`
|
3 |
+
|
4 |
+
java -mx700m -cp "$scriptdir/stanford-ner.jar:$scriptdir/lib/*" edu.stanford.nlp.ie.crf.CRFClassifier -loadClassifier $scriptdir/classifiers/english.all.3class.distsim.crf.ser.gz -textFile $1
|
stanford_model/sample-conll-file.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
John PERSON
|
2 |
+
Kerry PERSON
|
3 |
+
will O
|
4 |
+
fly O
|
5 |
+
to O
|
6 |
+
Paris LOCATION
|
7 |
+
this O
|
8 |
+
weekend O
|
9 |
+
. O
|
stanford_model/sample-w-time.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
Barack Obama was born on August 4, 1961 in Honolulu, Hawaii which was 4 days
|
2 |
+
ago.
|
stanford_model/sample.ner.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
The/O fate/O of/O Lehman/ORGANIZATION Brothers/ORGANIZATION ,/O the/O beleaguered/O investment/O bank/O ,/O hung/O in/O the/O balance/O on/O Sunday/O as/O Federal/ORGANIZATION Reserve/ORGANIZATION officials/O and/O the/O leaders/O of/O major/O financial/O institutions/O continued/O to/O gather/O in/O emergency/O meetings/O trying/O to/O complete/O a/O plan/O to/O rescue/O the/O stricken/O bank/O ./O
|
2 |
+
Several/O possible/O plans/O emerged/O from/O the/O talks/O ,/O held/O at/O the/O Federal/ORGANIZATION Reserve/ORGANIZATION Bank/ORGANIZATION of/ORGANIZATION New/ORGANIZATION York/ORGANIZATION and/O led/O by/O Timothy/PERSON R./PERSON Geithner/PERSON ,/O the/O president/O of/O the/O New/ORGANIZATION York/ORGANIZATION Fed/ORGANIZATION ,/O and/O Treasury/ORGANIZATION Secretary/O Henry/PERSON M./PERSON Paulson/PERSON Jr./PERSON ./O
|
stanford_model/sample.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
The fate of Lehman Brothers, the beleaguered investment bank, hung in the balance on Sunday as Federal Reserve officials and the leaders of major financial institutions continued to gather in emergency meetings trying to complete a plan to rescue the stricken bank. Several possible plans emerged from the talks, held at the Federal Reserve Bank of New York and led by Timothy R. Geithner, the president of the New York Fed, and Treasury Secretary Henry M. Paulson Jr.
|
stanford_model/stanford-ner-4.2.0-javadoc.jar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2400a6d94ec30c8aec36003e5a4d35d7f95651955220d608841566b123491bbf
|
3 |
+
size 5887473
|
stanford_model/stanford-ner-4.2.0-sources.jar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:67107462c51833c3073784e70d504fd1b5f5153c81eddc60ec106ae872d95b6c
|
3 |
+
size 3489930
|
stanford_model/stanford-ner-4.2.0.jar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b2478a64f37750c52c5aca933b4e29fa399b464ab80817946fa8f4f30c92ea60
|
3 |
+
size 4661456
|
stanford_model/stanford-ner.jar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b2478a64f37750c52c5aca933b4e29fa399b464ab80817946fa8f4f30c92ea60
|
3 |
+
size 4661456
|