neologdn 0.5.4__cp311-cp311-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of neologdn might be problematic. Click here for more details.

@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2015 Yukino Ikegami
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,421 @@
1
+ Metadata-Version: 2.1
2
+ Name: neologdn
3
+ Version: 0.5.4
4
+ Summary: Japanese text normalizer for mecab-neologd
5
+ Author-email: Yukino Ikegami <yknikgm@gmail.com>
6
+ Maintainer-email: Yukino Ikegami <yknikgm@gmail.com>
7
+ License: Apache License
8
+ Version 2.0, January 2004
9
+ http://www.apache.org/licenses/
10
+
11
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
12
+
13
+ 1. Definitions.
14
+
15
+ "License" shall mean the terms and conditions for use, reproduction,
16
+ and distribution as defined by Sections 1 through 9 of this document.
17
+
18
+ "Licensor" shall mean the copyright owner or entity authorized by
19
+ the copyright owner that is granting the License.
20
+
21
+ "Legal Entity" shall mean the union of the acting entity and all
22
+ other entities that control, are controlled by, or are under common
23
+ control with that entity. For the purposes of this definition,
24
+ "control" means (i) the power, direct or indirect, to cause the
25
+ direction or management of such entity, whether by contract or
26
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
27
+ outstanding shares, or (iii) beneficial ownership of such entity.
28
+
29
+ "You" (or "Your") shall mean an individual or Legal Entity
30
+ exercising permissions granted by this License.
31
+
32
+ "Source" form shall mean the preferred form for making modifications,
33
+ including but not limited to software source code, documentation
34
+ source, and configuration files.
35
+
36
+ "Object" form shall mean any form resulting from mechanical
37
+ transformation or translation of a Source form, including but
38
+ not limited to compiled object code, generated documentation,
39
+ and conversions to other media types.
40
+
41
+ "Work" shall mean the work of authorship, whether in Source or
42
+ Object form, made available under the License, as indicated by a
43
+ copyright notice that is included in or attached to the work
44
+ (an example is provided in the Appendix below).
45
+
46
+ "Derivative Works" shall mean any work, whether in Source or Object
47
+ form, that is based on (or derived from) the Work and for which the
48
+ editorial revisions, annotations, elaborations, or other modifications
49
+ represent, as a whole, an original work of authorship. For the purposes
50
+ of this License, Derivative Works shall not include works that remain
51
+ separable from, or merely link (or bind by name) to the interfaces of,
52
+ the Work and Derivative Works thereof.
53
+
54
+ "Contribution" shall mean any work of authorship, including
55
+ the original version of the Work and any modifications or additions
56
+ to that Work or Derivative Works thereof, that is intentionally
57
+ submitted to Licensor for inclusion in the Work by the copyright owner
58
+ or by an individual or Legal Entity authorized to submit on behalf of
59
+ the copyright owner. For the purposes of this definition, "submitted"
60
+ means any form of electronic, verbal, or written communication sent
61
+ to the Licensor or its representatives, including but not limited to
62
+ communication on electronic mailing lists, source code control systems,
63
+ and issue tracking systems that are managed by, or on behalf of, the
64
+ Licensor for the purpose of discussing and improving the Work, but
65
+ excluding communication that is conspicuously marked or otherwise
66
+ designated in writing by the copyright owner as "Not a Contribution."
67
+
68
+ "Contributor" shall mean Licensor and any individual or Legal Entity
69
+ on behalf of whom a Contribution has been received by Licensor and
70
+ subsequently incorporated within the Work.
71
+
72
+ 2. Grant of Copyright License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ copyright license to reproduce, prepare Derivative Works of,
76
+ publicly display, publicly perform, sublicense, and distribute the
77
+ Work and such Derivative Works in Source or Object form.
78
+
79
+ 3. Grant of Patent License. Subject to the terms and conditions of
80
+ this License, each Contributor hereby grants to You a perpetual,
81
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
82
+ (except as stated in this section) patent license to make, have made,
83
+ use, offer to sell, sell, import, and otherwise transfer the Work,
84
+ where such license applies only to those patent claims licensable
85
+ by such Contributor that are necessarily infringed by their
86
+ Contribution(s) alone or by combination of their Contribution(s)
87
+ with the Work to which such Contribution(s) was submitted. If You
88
+ institute patent litigation against any entity (including a
89
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
90
+ or a Contribution incorporated within the Work constitutes direct
91
+ or contributory patent infringement, then any patent licenses
92
+ granted to You under this License for that Work shall terminate
93
+ as of the date such litigation is filed.
94
+
95
+ 4. Redistribution. You may reproduce and distribute copies of the
96
+ Work or Derivative Works thereof in any medium, with or without
97
+ modifications, and in Source or Object form, provided that You
98
+ meet the following conditions:
99
+
100
+ (a) You must give any other recipients of the Work or
101
+ Derivative Works a copy of this License; and
102
+
103
+ (b) You must cause any modified files to carry prominent notices
104
+ stating that You changed the files; and
105
+
106
+ (c) You must retain, in the Source form of any Derivative Works
107
+ that You distribute, all copyright, patent, trademark, and
108
+ attribution notices from the Source form of the Work,
109
+ excluding those notices that do not pertain to any part of
110
+ the Derivative Works; and
111
+
112
+ (d) If the Work includes a "NOTICE" text file as part of its
113
+ distribution, then any Derivative Works that You distribute must
114
+ include a readable copy of the attribution notices contained
115
+ within such NOTICE file, excluding those notices that do not
116
+ pertain to any part of the Derivative Works, in at least one
117
+ of the following places: within a NOTICE text file distributed
118
+ as part of the Derivative Works; within the Source form or
119
+ documentation, if provided along with the Derivative Works; or,
120
+ within a display generated by the Derivative Works, if and
121
+ wherever such third-party notices normally appear. The contents
122
+ of the NOTICE file are for informational purposes only and
123
+ do not modify the License. You may add Your own attribution
124
+ notices within Derivative Works that You distribute, alongside
125
+ or as an addendum to the NOTICE text from the Work, provided
126
+ that such additional attribution notices cannot be construed
127
+ as modifying the License.
128
+
129
+ You may add Your own copyright statement to Your modifications and
130
+ may provide additional or different license terms and conditions
131
+ for use, reproduction, or distribution of Your modifications, or
132
+ for any such Derivative Works as a whole, provided Your use,
133
+ reproduction, and distribution of the Work otherwise complies with
134
+ the conditions stated in this License.
135
+
136
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
137
+ any Contribution intentionally submitted for inclusion in the Work
138
+ by You to the Licensor shall be under the terms and conditions of
139
+ this License, without any additional terms or conditions.
140
+ Notwithstanding the above, nothing herein shall supersede or modify
141
+ the terms of any separate license agreement you may have executed
142
+ with Licensor regarding such Contributions.
143
+
144
+ 6. Trademarks. This License does not grant permission to use the trade
145
+ names, trademarks, service marks, or product names of the Licensor,
146
+ except as required for reasonable and customary use in describing the
147
+ origin of the Work and reproducing the content of the NOTICE file.
148
+
149
+ 7. Disclaimer of Warranty. Unless required by applicable law or
150
+ agreed to in writing, Licensor provides the Work (and each
151
+ Contributor provides its Contributions) on an "AS IS" BASIS,
152
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
153
+ implied, including, without limitation, any warranties or conditions
154
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
155
+ PARTICULAR PURPOSE. You are solely responsible for determining the
156
+ appropriateness of using or redistributing the Work and assume any
157
+ risks associated with Your exercise of permissions under this License.
158
+
159
+ 8. Limitation of Liability. In no event and under no legal theory,
160
+ whether in tort (including negligence), contract, or otherwise,
161
+ unless required by applicable law (such as deliberate and grossly
162
+ negligent acts) or agreed to in writing, shall any Contributor be
163
+ liable to You for damages, including any direct, indirect, special,
164
+ incidental, or consequential damages of any character arising as a
165
+ result of this License or out of the use or inability to use the
166
+ Work (including but not limited to damages for loss of goodwill,
167
+ work stoppage, computer failure or malfunction, or any and all
168
+ other commercial damages or losses), even if such Contributor
169
+ has been advised of the possibility of such damages.
170
+
171
+ 9. Accepting Warranty or Additional Liability. While redistributing
172
+ the Work or Derivative Works thereof, You may choose to offer,
173
+ and charge a fee for, acceptance of support, warranty, indemnity,
174
+ or other liability obligations and/or rights consistent with this
175
+ License. However, in accepting such obligations, You may act only
176
+ on Your own behalf and on Your sole responsibility, not on behalf
177
+ of any other Contributor, and only if You agree to indemnify,
178
+ defend, and hold each Contributor harmless for any liability
179
+ incurred by, or claims asserted against, such Contributor by reason
180
+ of your accepting any such warranty or additional liability.
181
+
182
+ END OF TERMS AND CONDITIONS
183
+
184
+ APPENDIX: How to apply the Apache License to your work.
185
+
186
+ To apply the Apache License to your work, attach the following
187
+ boilerplate notice, with the fields enclosed by brackets "{}"
188
+ replaced with your own identifying information. (Don't include
189
+ the brackets!) The text should be enclosed in the appropriate
190
+ comment syntax for the file format. We also recommend that a
191
+ file or class name and description of purpose be included on the
192
+ same "printed page" as the copyright notice for easier
193
+ identification within third-party archives.
194
+
195
+ Copyright 2015 Yukino Ikegami
196
+
197
+ Licensed under the Apache License, Version 2.0 (the "License");
198
+ you may not use this file except in compliance with the License.
199
+ You may obtain a copy of the License at
200
+
201
+ http://www.apache.org/licenses/LICENSE-2.0
202
+
203
+ Unless required by applicable law or agreed to in writing, software
204
+ distributed under the License is distributed on an "AS IS" BASIS,
205
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
206
+ See the License for the specific language governing permissions and
207
+ limitations under the License.
208
+
209
+
210
+ Project-URL: Homepage, https://github.com/ikegami-yukino/neologdn
211
+ Project-URL: Repository, https://github.com/ikegami-yukino/neologdn.git
212
+ Keywords: MeCab,NEologd,japanese,textpreprocessing,JapaneseText
213
+ Classifier: Development Status :: 4 - Beta
214
+ Classifier: Intended Audience :: Science/Research
215
+ Classifier: Intended Audience :: Developers
216
+ Classifier: Natural Language :: Japanese
217
+ Classifier: License :: OSI Approved :: Apache Software License
218
+ Classifier: Programming Language :: Cython
219
+ Classifier: Programming Language :: Python
220
+ Classifier: Programming Language :: Python :: 3
221
+ Classifier: Programming Language :: Python :: 3.8
222
+ Classifier: Programming Language :: Python :: 3.9
223
+ Classifier: Programming Language :: Python :: 3.10
224
+ Classifier: Programming Language :: Python :: 3.11
225
+ Classifier: Programming Language :: Python :: 3.12
226
+ Classifier: Programming Language :: Python :: 3.13
227
+ Classifier: Topic :: Text Processing :: Linguistic
228
+ Classifier: Topic :: Text Processing
229
+ Description-Content-Type: text/markdown
230
+ License-File: LICENSE
231
+
232
+ # neologdn
233
+
234
+ [![PyPI Downloads](https://static.pepy.tech/badge/neologdn)](https://pepy.tech/projects/neologdn)![PyPI - Version](https://img.shields.io/pypi/v/neologdn)![PyPI - Python Version](https://img.shields.io/pypi/pyversions/neologdn)![PyPI - License](https://img.shields.io/pypi/l/neologdn)
235
+
236
+ neologdn is a Japanese text normalizer for [mecab-neologd](https://github.com/neologd/mecab-ipadic-neologd).
237
+
238
+ The normalization is based on the neologd's rules:
239
+ https://github.com/neologd/mecab-ipadic-neologd/wiki/Regexp.ja
240
+
241
+ And also some optional features are added.
242
+
243
+ Contributions are welcome!
244
+
245
+ NOTE: Installing this module requires C++11 compiler.
246
+
247
+ ## Installation
248
+
249
+ ```sh
250
+ pip install neologdn
251
+ ```
252
+
253
+ If setuptools is not installed, you must install it:
254
+
255
+ ```sh
256
+ pip install setuptools
257
+ ```
258
+
259
+ If you encountered the following error:
260
+
261
+ ```sh
262
+ ERROR: Could not find a version that satisfies the requirement setuptools (from versions: none)
263
+ ```
264
+
265
+ Then execute the following commands to may solve this error:
266
+
267
+ ```sh
268
+ pip install wheel
269
+ pip install --no-build-isolation neologdn
270
+ ```
271
+
272
+ ## Usage
273
+
274
+ ```python
275
+ import neologdn
276
+ neologdn.normalize("ハンカクカナ")
277
+ # => 'ハンカクカナ'
278
+ neologdn.normalize("全角記号!?@#")
279
+ # => '全角記号!?@#'
280
+ neologdn.normalize("全角記号例外「・」")
281
+ # => '全角記号例外「・」'
282
+ neologdn.normalize("長音短縮ウェーーーーイ")
283
+ # => '長音短縮ウェーイ'
284
+ neologdn.normalize("チルダ削除ウェ~∼∾〜〰~イ")
285
+ # => 'チルダ削除ウェイ'
286
+ neologdn.normalize("いろんなハイフン˗֊‐‑‒–⁃⁻₋−")
287
+ # => 'いろんなハイフン-'
288
+ neologdn.normalize("   PRML  副 読 本   ")
289
+ # => 'PRML副読本'
290
+ neologdn.normalize(" Natural Language Processing ")
291
+ # => 'Natural Language Processing'
292
+ neologdn.normalize("かわいいいいいいいいい", repeat=6)
293
+ # => 'かわいいいいいい'
294
+ neologdn.normalize("無駄無駄無駄無駄ァ", repeat=1)
295
+ # => '無駄ァ'
296
+ neologdn.normalize("1995〜2001年", tilde="normalize")
297
+ # => '1995~2001年'
298
+ neologdn.normalize("1995~2001年", tilde="normalize_zenkaku")
299
+ # => '1995〜2001年'
300
+ neologdn.normalize("1995〜2001年", tilde="ignore") # Don't convert tilde
301
+ # => '1995〜2001年'
302
+ neologdn.normalize("1995〜2001年", tilde="remove")
303
+ # => '19952001年'
304
+ neologdn.normalize("1995〜2001年") # Default parameter
305
+ # => '19952001年'
306
+ ```
307
+
308
+
309
+ ## Benchmark
310
+
311
+ ```python
312
+
313
+ # Sample code from
314
+ # https://github.com/neologd/mecab-ipadic-neologd/wiki/Regexp.ja#python-written-by-hideaki-t--overlast
315
+ import normalize_neologd
316
+
317
+ %timeit normalize(normalize_neologd.normalize_neologd)
318
+ # => 9.55 s ± 29.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
319
+
320
+ import neologdn
321
+ %timeit normalize(neologdn.normalize)
322
+ # => 6.66 s ± 35.8 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
323
+ ```
324
+
325
+ neologdn is about x1.43 faster than sample code.
326
+
327
+ details are described as the below notebook:
328
+ https://github.com/ikegami-yukino/neologdn/blob/master/benchmark/benchmark.ipynb
329
+
330
+ ## License
331
+
332
+ Apache Software License.
333
+
334
+ ## CHANGES
335
+
336
+ ### 0.5.4 (2025-03-15)
337
+
338
+ - Support Python 3.13
339
+ - Fix tilde loss after latin and whitespace (Many thanks @a-lucky)
340
+
341
+ ### 0.5.3 (2024-05-03)
342
+
343
+ - Support Python 3.12
344
+
345
+ ### 0.5.2 (2023-08-03)
346
+
347
+ - Support Python 3.10 and 3.11 (Many thanks @polm)
348
+
349
+ ### 0.5.1 (2021-05-02)
350
+
351
+ - Improve performance of shorten_repeat function (Many thanks @yskn67)
352
+ - Add tilde option to normalize function
353
+
354
+ ### 0.4 (2018-12-06)
355
+
356
+ - Add shorten_repeat function, which shortening contiguous substring. For example: neologdn.normalize("無駄無駄無駄無駄ァ", repeat=1) -> 無駄ァ
357
+
358
+ ### 0.3.2 (2018-05-17)
359
+
360
+ - Add option for suppression removal of spaces between Japanese characters
361
+
362
+ ### 0.2.2 (2018-03-10)
363
+
364
+ - Fix bug (daku-ten & handaku-ten)
365
+ - Support mac osx 10.13 (Many thanks @r9y9)
366
+
367
+ ### 0.2.1 (2017-01-23)
368
+
369
+ - Fix bug (Check if a previous character of daku-ten character is in maps) (Many thanks @unnonouno)
370
+
371
+ ### 0.2 (2016-04-12)
372
+
373
+ - Add lengthened expression (repeating character) threshold
374
+
375
+ ### 0.1.2 (2016-03-29)
376
+
377
+ - Fix installation bug
378
+
379
+ ### 0.1.1.1 (2016-03-19)
380
+
381
+ - Support Windows
382
+ - Explicitly specify to -std=c++11 in build (Many thanks @id774)
383
+
384
+ ### 0.1.1 (2015-10-10)
385
+
386
+ Initial release.
387
+
388
+ ## Contribution
389
+
390
+ Contributions are welcome! See: https://github.com/ikegami-yukino/neologdn/blob/master/.github/CONTRIBUTING.md
391
+
392
+ ## Cited by
393
+
394
+ ### Book
395
+
396
+ - 山本 和英. テキスト処理の要素技術. 近代科学者. P.41. 2021.
397
+
398
+ ### Blog
399
+
400
+ - 【ライブラリ紹介】テキスト正規化ライブラリ neologdn: https://diatonic.codes/blog/neologdn/
401
+ - 日本語テキストの前処理:neologdn、大文字小文字、Unicode正規化 - tuttieee’s blog: https://tuttieee.hatenablog.com/entry/ja-nlp-preprocess
402
+ - ▲本日の関数==neologdn.normalize()== - TPTブログ: https://ds-blog.tbtech.co.jp/entry/2020/05/11/%E2%96%B2%E6%9C%AC%E6%97%A5%E3%81%AE%E9%96%A2%E6%95%B0%3D%3Dneologdn_normalize%28%29%3D%3D
403
+ - NLPについて学ぶ: https://zenn.dev/panyoriokome/scraps/d67f68ab50c0c1
404
+ - テキスト正規化用PythonライブラリをMATLABからコール #Python - Qiita: https://qiita.com/aoimidori/items/ab5a4383b5a7bb307bad
405
+ - 自然言語処理の前処理手順をPythonコード付きでご紹介 | AI活用・AI導入事例の紹介 | AI活用・AI導入事例の紹介: https://www.matrixflow.net/case-study/75/
406
+ - pythonによる日本語前処理備忘録 | DATUM STUDIO株式会社: https://datumstudio.jp/blog/python%E3%81%AB%E3%82%88%E3%82%8B%E6%97%A5%E6%9C%AC%E8%AA%9E%E5%89%8D%E5%87%A6%E7%90%86%E5%82%99%E5%BF%98%E9%8C%B2/
407
+ - 前処理、前処理、そして、前処理 (自然言語処理:日本語編)|narudesu: https://note.com/narudesu/n/na35de30a583a
408
+ - ショートカットキーでneologd.normalize: https://scrapbox.io/nishio/%E3%82%B7%E3%83%A7%E3%83%BC%E3%83%88%E3%82%AB%E3%83%83%E3%83%88%E3%82%AD%E3%83%BC%E3%81%A7neologd.normalize
409
+ - Pythonで自然言語処理を行うための環境構築 #Python - Qiita: https://qiita.com/lawyer_alpaca/items/86b0deda984170203467
410
+ - Python normalize Examples: https://python.hotexamples.com/examples/neologdn/-/normalize/python-normalize-function-examples.html
411
+ - 株式会社ししまろ (ch-4) 潜在的ディリクレ配分(LDA)によるchABSAデータセットの分析: https://shishimaro.co.jp/blog/ai/538
412
+ - 形態素解析前の日本語文書の前処理 (Python) - け日記: https://ohke.hateblo.jp/entry/2019/02/09/141500
413
+ - 人工知能に言語を理解させる!?自然言語処理に重要なデータの前処理をPythonで徹底解説 | AI研究所: https://ai-kenkyujo.com/programming/make-ai-understand-the-language/
414
+ - 最新wikipediaを反映したMeCabユーザー辞書を作る - NEologd拡張 | ぷらこめ: https://purakome.net/mecab/addwiki/
415
+ - 【自然言語処理入門】文に対してストップワードと正規化から処理を施す | マイナビエンジニアブログ: https://engineerblog.mynavi.jp/technology/nlp_stopword/
416
+ - 表記統一 [自然言語処理の餅屋]: https://www.jnlp.org/nlp/%E6%A0%A1%E6%AD%A3/%E8%A1%A8%E8%A8%98%E7%B5%B1%E4%B8%80
417
+ - Pytorchを使ってテキスト生成モデルのT5を構築 〜Transformersでの転移学習による手軽な実践〜 - 見習いデータサイエンティストの隠れ家: https://www.dskomei.com/entry/2021/09/28/110016
418
+ - 象と散歩: Goolge Colabでお手軽テキストマイニング(日本語前処理): https://walking-elephant.blogspot.com/2023/07/text-mining-normalized.html
419
+ - 【Pythonで自然言語処理(NLP)を実装してみよう!】学ぶべき知識についても徹底解説! - ベトナムオフショア開発の最前線 by Mattock inc.: https://mattock.jp/blog/artificial-intelligence/nlp/lets-implement-nlp-in-python/
420
+ - tools [Digital Humanities Japan: Resource Wiki]: https://dhjapan.org/wiki/doku.php?id=tools
421
+ - Pythonで現代の季語を調べてみた | Aidemy | 10秒で始めるAIプログラミング学習サービスAidemy[アイデミー]: https://aidemy.net/magazine/703/
@@ -0,0 +1,7 @@
1
+ neologdn.cp311-win32.pyd,sha256=Wh9frhVOWRwvE9KcMYf2l01V5-cpYfwzAVKzPUhj7o0,71168
2
+ test_neologdn.py,sha256=oDSKmoYoBX936r4gX95LlnoWFmCZqvwl9VTF6B08QVw,4294
3
+ neologdn-0.5.4.dist-info/LICENSE,sha256=by4ifwXxhgMhU4eP1DMM7g-VdtQb2JQSNm0cUfpZjHQ,11547
4
+ neologdn-0.5.4.dist-info/METADATA,sha256=WEsOlrJ4O1jMjhCNZkiKhY-Fu6WuLq5XTL42ZTbWDoE,22625
5
+ neologdn-0.5.4.dist-info/WHEEL,sha256=xweO4iRfoXWmWg5ExglYm3Rp6_pxKiu4krO0RRxByhE,98
6
+ neologdn-0.5.4.dist-info/top_level.txt,sha256=XGtMNw_2PR189vP77p1xUQJXwncy446J_D6El6_H0-A,23
7
+ neologdn-0.5.4.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.44.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp311-cp311-win32
5
+
@@ -0,0 +1,2 @@
1
+ neologdn
2
+ test_neologdn
Binary file
test_neologdn.py ADDED
@@ -0,0 +1,64 @@
1
+ # encoding: utf8
2
+ from __future__ import unicode_literals
3
+ import unittest
4
+ from neologdn import normalize, shorten_repeat
5
+
6
+
7
+ class TestNeologdn(unittest.TestCase):
8
+
9
+ def test_normalize(self):
10
+ self.assertEqual(normalize('0'), '0')
11
+ self.assertEqual(normalize('ハンカク'), 'ハンカク')
12
+ self.assertEqual(normalize('o₋o'), 'o-o')
13
+ self.assertEqual(normalize('majika━'), 'majikaー')
14
+ self.assertEqual(normalize('わ〰い'), 'わい')
15
+ self.assertEqual(normalize('スーパーーーー'), 'スーパー')
16
+ self.assertEqual(normalize('!#'), '!#')
17
+ self.assertEqual(normalize('ゼンカク スペース'), 'ゼンカクスペース')
18
+ self.assertEqual(normalize('お お'), 'おお')
19
+ self.assertEqual(normalize(' おお'), 'おお')
20
+ self.assertEqual(normalize('おお '), 'おお')
21
+ self.assertEqual(normalize('検索 エンジン 自作 入門 を 買い ました!!!'),\
22
+ '検索エンジン自作入門を買いました!!!')
23
+ self.assertEqual(normalize('アルゴリズム C'), 'アルゴリズムC')
24
+ self.assertEqual(normalize('   PRML  副 読 本   '), 'PRML副読本')
25
+ self.assertEqual(normalize('Coding the Matrix'), 'Coding the Matrix')
26
+ self.assertEqual(normalize('南アルプスの 天然水 Sparking Lemon レモン一絞り'),\
27
+ '南アルプスの天然水Sparking Lemonレモン一絞り')
28
+ self.assertEqual(normalize('南アルプスの 天然水- Sparking* Lemon+ レモン一絞り'),\
29
+ '南アルプスの天然水- Sparking*Lemon+レモン一絞り')
30
+ self.assertEqual(normalize('パパ'), 'パパ')
31
+ self.assertEqual(normalize('a˗֊‐‑‒–⁃⁻₋−'), 'a-')
32
+ self.assertEqual(normalize('あ﹣-ー—―─━ー'), 'あー')
33
+ self.assertEqual(normalize('チルダ~∼∾〜〰~'), 'チルダ')
34
+ self.assertEqual(normalize('う゛ぽ'), 'ゔぽ')
35
+
36
+ def test_shorten_repeat(self):
37
+ self.assertEqual(shorten_repeat('うまああああああああああああい', 7, 0), 'うまあああああああい')
38
+ self.assertEqual(shorten_repeat('かわいいいいいるい', 6, 0), 'かわいいいいいるい')
39
+ self.assertEqual(shorten_repeat('オラオラオラオラーッ', 2, 0), 'オラオラーッ')
40
+ self.assertEqual(shorten_repeat('無駄無駄無駄無駄ァ', 1, 0), '無駄ァ')
41
+ self.assertEqual(shorten_repeat('隣の客はよく柿食う客だ、隣の客はよく柿食う客だ、隣の客はよく柿食う客だ、言えた!', 1, 0),
42
+ '隣の客はよく柿食う客だ、言えた!')
43
+ self.assertEqual(shorten_repeat('隣の客はよく柿食う客だ、隣の客はよく柿食う客だ、隣の客はよく柿食う客だ、言えた!', 1, 11),
44
+ '隣の客はよく柿食う客だ、隣の客はよく柿食う客だ、隣の客はよく柿食う客だ、言えた!')
45
+
46
+ def test_suppress_removal_of_spaces_between_Japanese(self):
47
+ self.assertEqual(normalize('巴 マミ', remove_space=False), '巴 マミ')
48
+
49
+ def test_handling_tilde(self):
50
+ self.assertEqual(normalize('1467〜1487年', tilde='normalize'), '1467~1487年')
51
+ self.assertEqual(normalize('1467~1487年', tilde='normalize_zenkaku'), '1467〜1487年')
52
+ self.assertEqual(normalize('1467〜1487年', tilde='ignore'), '1467〜1487年')
53
+ self.assertEqual(normalize('1467〜1487年', tilde='remove'), '14671487年')
54
+ self.assertEqual(normalize('1467〜1487年'), '14671487年')
55
+
56
+ def test_tilde_boundary_handling(self):
57
+ self.assertEqual(normalize('A ˗あ'), 'A -あ')
58
+ self.assertEqual(normalize('A ーあ'), 'A ーあ')
59
+ self.assertEqual(normalize('A ~あ', tilde='normalize'), 'A ~あ')
60
+ self.assertEqual(normalize('A ~あ', tilde='normalize_zenkaku'), 'A 〜あ')
61
+ self.assertEqual(normalize('A ~あ'), 'Aあ')
62
+
63
+ if __name__ == '__main__':
64
+ unittest.main()