zbller commited on
Commit
a5597da
·
verified ·
1 Parent(s): 28076b1

Upload folder using huggingface_hub

Browse files
Files changed (6) hide show
  1. LICENSE +158 -0
  2. README.md +11 -9
  3. app.py +1 -1
  4. mecari/analyzers/mecab.py +44 -2
  5. pyproject.toml +1 -0
  6. readme2.md +2 -22
LICENSE ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Creative Commons Attribution-NonCommercial 4.0 International
2
+
3
+ Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
4
+
5
+ Using Creative Commons Public Licenses
6
+
7
+ Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
8
+
9
+ - Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors: wiki.creativecommons.org/Considerations_for_licensors
10
+
11
+ - Considerations for the public: By using one of our public licenses, a licensee accepts and agrees to be bound by its terms and conditions. The licensor grants the licensee the rights described in the license in consideration of the licensee's acceptance of these terms and conditions. Our licenses are irrevocable. Licensed material is provided "as-is" and Creative Commons disclaims all warranties with respect to the licensed material. More considerations for the public: wiki.creativecommons.org/Considerations_for_licensees
12
+
13
+ Creative Commons Attribution-NonCommercial 4.0 International Public License
14
+
15
+ By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
16
+
17
+ Section 1 – Definitions.
18
+
19
+ a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
20
+
21
+ b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
22
+
23
+ c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
24
+
25
+ d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
26
+
27
+ e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
28
+
29
+ f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
30
+
31
+ g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
32
+
33
+ h. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
34
+
35
+ i. NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
36
+
37
+ j. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
38
+
39
+ k. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
40
+
41
+ l. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
42
+
43
+ Section 2 – Scope.
44
+
45
+ a. License grant.
46
+
47
+ 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
48
+
49
+ A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
50
+
51
+ B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
52
+
53
+ 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
54
+
55
+ 3. Term. The term of this Public License is specified in Section 6(a).
56
+
57
+ 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
58
+
59
+ 5. Downstream recipients.
60
+
61
+ A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
62
+
63
+ B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
64
+
65
+ 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
66
+
67
+ b. Other rights.
68
+
69
+ 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
70
+
71
+ 2. Patent and trademark rights are not licensed under this Public License.
72
+
73
+ 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
74
+
75
+ Section 3 – License Conditions.
76
+
77
+ Your exercise of the Licensed Rights is expressly made subject to the following conditions.
78
+
79
+ a. Attribution.
80
+
81
+ 1. If You Share the Licensed Material (including in modified form), You must:
82
+
83
+ A. retain the following if it is supplied by the Licensor with the Licensed Material:
84
+
85
+ i. identification of the creator(s) of the Licensed Material and any other designated persons, reasonably requested by the Licensor, and to the extent reasonably practicable;
86
+
87
+ ii. a copyright notice;
88
+
89
+ iii. a notice that refers to this Public License;
90
+
91
+ iv. a notice that refers to the disclaimer of warranties;
92
+
93
+ v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
94
+
95
+ B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
96
+
97
+ C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
98
+
99
+ 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
100
+
101
+ 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
102
+
103
+ Section 4 – Sui Generis Database Rights.
104
+
105
+ Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
106
+
107
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
108
+
109
+ b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
110
+
111
+ c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
112
+
113
+ For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
114
+
115
+ Section 5 – Disclaimer of Warranties and Limitation of Liability.
116
+
117
+ a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
118
+
119
+ b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
120
+
121
+ c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
122
+
123
+ Section 6 – Term and Termination.
124
+
125
+ a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
126
+
127
+ b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
128
+
129
+ 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
130
+
131
+ 2. upon express reinstatement by the Licensor.
132
+
133
+ c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
134
+
135
+ d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
136
+
137
+ e. Sections 1, 5, 6, and 7 survive termination of this Public License.
138
+
139
+ Section 7 – Other Terms and Conditions.
140
+
141
+ a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
142
+
143
+ b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
144
+
145
+ Section 8 – Interpretation.
146
+
147
+ a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
148
+
149
+ b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
150
+
151
+ c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
152
+
153
+ d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
154
+
155
+ Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
156
+
157
+ Creative Commons may be contacted at creativecommons.org.
158
+
README.md CHANGED
@@ -11,11 +11,12 @@ pinned: false
11
 
12
  # Mecari (Japanese Morphological Analysis with Graph Neural Networks)
13
 
14
- ## Training
 
15
 
16
- ### Overview
17
 
18
- Mecari [1] is a GNN‑based Japanese morphological analyzer. It supports training from partially annotated graphs (only '+'/'-' where available; '?' is ignored) and aims for fast training and inference.
19
 
20
  <p align="center">
21
  <img src="abst.png" alt="Overview" width="70%" />
@@ -39,14 +40,15 @@ Nodes are featurized with JUMAN++‑style unigram features, edges are modeled as
39
  ### Inference
40
  Use the model’s node scores and run Viterbi to search the optimal non‑overlapping path.
41
 
42
- ## Results (KWDLC test)
43
 
44
  - Trained model (sample_model): Seg F1 0.9725, POS F1 0.9562
45
  - MeCab (JUMANDIC) baseline: Seg F1 0.9677, POS F1 0.9465
46
 
47
  The GATv2 model trained with this repository (current code and `configs/gatv2.yaml`) using the official KWDLC split outperforms MeCab on both segmentation and POS accuracy.
48
 
49
- ## Tested Environment
 
50
 
51
  - OS: Ubuntu 24.04.3 LTS (Noble Numbat)
52
  - Python: 3.11.3
@@ -55,7 +57,7 @@ The GATv2 model trained with this repository (current code and `configs/gatv2.ya
55
  - MeCab (binary): 0.996
56
  - JUMANDIC: `/var/lib/mecab/dic/juman-utf8`
57
 
58
- ## MeCab Setup (Ubuntu 24.04)
59
  1) Install packages (includes the JUMANDIC dictionary)
60
 
61
  ```bash
@@ -70,7 +72,7 @@ mecab -v # e.g., mecab of 0.996
70
  test -d /var/lib/mecab/dic/juman-utf8 && echo "JUMANDIC OK"
71
  ```
72
 
73
- ## Project Setup
74
 
75
  ```bash
76
  # Install uv if needed
@@ -146,8 +148,8 @@ python evaluate.py --max-samples 50 \
146
  CC BY‑NC 4.0 (non‑commercial use only)
147
 
148
  ## Acknowledgments
149
- - [1] Technical inspiration: Mecari, a morphological analysis system developed by Google, as described in “Data processing for Japanese text‑to‑pronunciation models by G. Mazovetskiy and T. Kudo (NLP2024 Workshop on Japanese Language Resources). URL: https://jedworkshop.github.io/JLR2024/materials/b-2.pdf (pp. 19–23)
150
- - [2] Graph architecture: Brody, Shaked, Uri Alon, and Eran Yahav. "HOW ATTENTIVE ARE GRAPH ATTENTION NETWORKS?." 10th International Conference on Learning Representations, ICLR 2022. 2022.
151
 
152
  ## Disclaimer
153
  - Independent academic implementation for educational and research purposes.
 
11
 
12
  # Mecari (Japanese Morphological Analysis with Graph Neural Networks)
13
 
14
+ ## Demo
15
+ You can try Mecari in https://huggingface.co/spaces/zbller/Mecari
16
 
17
+ ## Overview
18
 
19
+ Mecari [1] is Google's GNN(Graph Neural Network)‑based Japanese morphological analyzer. It supports training from partially annotated graphs (only '+'/'-' where available; '?' is ignored) and aims for fast training and inference.
20
 
21
  <p align="center">
22
  <img src="abst.png" alt="Overview" width="70%" />
 
40
  ### Inference
41
  Use the model’s node scores and run Viterbi to search the optimal non‑overlapping path.
42
 
43
+ ### Results (KWDLC test)
44
 
45
  - Trained model (sample_model): Seg F1 0.9725, POS F1 0.9562
46
  - MeCab (JUMANDIC) baseline: Seg F1 0.9677, POS F1 0.9465
47
 
48
  The GATv2 model trained with this repository (current code and `configs/gatv2.yaml`) using the official KWDLC split outperforms MeCab on both segmentation and POS accuracy.
49
 
50
+ ## Environmental Setup
51
+ ### Tested Environment
52
 
53
  - OS: Ubuntu 24.04.3 LTS (Noble Numbat)
54
  - Python: 3.11.3
 
57
  - MeCab (binary): 0.996
58
  - JUMANDIC: `/var/lib/mecab/dic/juman-utf8`
59
 
60
+ ### MeCab Setup (Ubuntu 24.04)
61
  1) Install packages (includes the JUMANDIC dictionary)
62
 
63
  ```bash
 
72
  test -d /var/lib/mecab/dic/juman-utf8 && echo "JUMANDIC OK"
73
  ```
74
 
75
+ ### Project Setup
76
 
77
  ```bash
78
  # Install uv if needed
 
148
  CC BY‑NC 4.0 (non‑commercial use only)
149
 
150
  ## Acknowledgments
151
+ - [1] “Data processing for Japanese text‑to‑pronunciation models”, Gleb Mazovetskiy, Taku Kudo, NLP2024 Workshop on Japanese Language Resources, URL: https://jedworkshop.github.io/JLR2024/materials/b-2.pdf (pp. 19–23)
152
+ - [2] "HOW ATTENTIVE ARE GRAPH ATTENTION NETWORKS?.", Graph architecture: Brody, Shaked, Uri Alon, and Eran Yahav, 10th International Conference on Learning Representations, ICLR 2022. 2022.
153
 
154
  ## Disclaimer
155
  - Independent academic implementation for educational and research purposes.
app.py CHANGED
@@ -171,4 +171,4 @@ with gr.Blocks(theme=gr.themes.Soft(), css=FONT_CSS) as demo:
171
  _warmup()
172
 
173
  if __name__ == "__main__":
174
- demo.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", "7863")))
 
171
  _warmup()
172
 
173
  if __name__ == "__main__":
174
+ demo.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", "7860")))
mecari/analyzers/mecab.py CHANGED
@@ -129,8 +129,7 @@ class MeCabAnalyzer:
129
  node_id, surface, features, sb, eb = parts[0], parts[1], parts[2], parts[3], parts[4]
130
  if surface in ("BOS", "EOS"):
131
  continue
132
- if not surface.strip():
133
- continue
134
  try:
135
  start_byte = int(sb)
136
  end_byte = int(eb)
@@ -168,4 +167,47 @@ class MeCabAnalyzer:
168
  continue
169
  seen.add(key)
170
  out.append(m)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  return out
 
129
  node_id, surface, features, sb, eb = parts[0], parts[1], parts[2], parts[3], parts[4]
130
  if surface in ("BOS", "EOS"):
131
  continue
132
+
 
133
  try:
134
  start_byte = int(sb)
135
  end_byte = int(eb)
 
167
  continue
168
  seen.add(key)
169
  out.append(m)
170
+ # Synthesize whitespace nodes for gaps if MeCab didn't output them
171
+ if text:
172
+ existing_ws_spans = set()
173
+ for m in out:
174
+ surf = m.get("surface", "")
175
+ if surf.strip() == "":
176
+ cs = m.get("start_pos", 0)
177
+ ce = m.get("end_pos", 0)
178
+ existing_ws_spans.add((cs, ce))
179
+
180
+ i = 0
181
+ n = len(text)
182
+ while i < n:
183
+ ch = text[i]
184
+ if ch.isspace():
185
+ j = i + 1
186
+ while j < n and text[j].isspace():
187
+ j += 1
188
+ span = (i, j)
189
+ if span not in existing_ws_spans:
190
+ ws = text[i:j]
191
+ wm = {
192
+ "surface": ws,
193
+ "pos": "特殊",
194
+ "pos_detail1": "空白",
195
+ "pos_detail2": "*",
196
+ "pos_detail3": "*",
197
+ "base_form": "",
198
+ "reading": "",
199
+ "inflection_type": "*",
200
+ "inflection_form": "*",
201
+ "start_pos": i,
202
+ "end_pos": j,
203
+ "annotation": "?",
204
+ "node_id": f"WS_{i}_{j}",
205
+ }
206
+ key = signature_key(wm)
207
+ if key not in seen:
208
+ seen.add(key)
209
+ out.append(wm)
210
+ i = j
211
+ else:
212
+ i += 1
213
  return out
pyproject.toml CHANGED
@@ -4,6 +4,7 @@ version = "0.1.0"
4
  description = "Japanese morphological analysis using Graph Neural Networks"
5
  readme = "README.md"
6
  requires-python = ">=3.11,<3.12"
 
7
  dependencies = [
8
  "torch>=2.2,<2.3",
9
  "pytorch-lightning>=2.0.0",
 
4
  description = "Japanese morphological analysis using Graph Neural Networks"
5
  readme = "README.md"
6
  requires-python = ">=3.11,<3.12"
7
+ license = { file = "LICENSE" }
8
  dependencies = [
9
  "torch>=2.2,<2.3",
10
  "pytorch-lightning>=2.0.0",
readme2.md CHANGED
@@ -1,26 +1,8 @@
1
  # Mecari (Japanese Morphological Analysis with Graph Neural Networks)
2
-
3
- 本ドキュメントは既存の README を整理し、セットアップや再現、評価の手順、既知の制限やトラブルシュートを強化した改訂版です。
4
-
5
- - Demo: https://huggingface.co/spaces/zbller/Mecari (推論デモ。CPU/ブラウザ実行、学習は未対応)
6
-
7
- ## 目次
8
- - 概要
9
- - 結果(KWDLC)
10
- - 動作環境
11
- - MeCab のセットアップ
12
- - プロジェクトセットアップ(uv / pip)
13
- - クイックスタート(形態素解析)
14
- - 学習と評価(KWDLC)
15
- - コンフィグ概要
16
- - 実験ディレクトリと再開
17
- - トラブルシュート
18
- - 既知の制限
19
- - ライセンスと謝辞
20
- - 参考文献
21
 
22
  ## 概要
23
- Mecari は、公開研究 [1] のアイデアに着想を得た GNN(Graph Neural Network)ベースの日本語形態素解析器です。MeCab(JUMANDIC)の候補からグラフを構築し、部分アノテーション('+'/'-'、'?'は学習で無視)で学習可能、学習・推論の高速化を重視しています。ノードには JUMAN++ 風のユニグラム特徴量、エッジは無向(双方向)として扱い、GATv2 [2] を学習します。推論ではノードスコアに基づき Viterbi で非重複の最適経路を探索します。
24
 
25
  ## 結果(KWDLC)
26
  - 学習済み(`sample_model`): Seg F1 0.9725, POS F1 0.9562
@@ -29,8 +11,6 @@ Mecari は、公開研究 [1] のアイデアに着想を得た GNN(Graph Neur
29
  再現メモ
30
  - データ: 公式 KWDLC の `dev.id`/`test.id` 分割を使用
31
  - コンフィグ: `configs/gatv2.yaml`(`extends: base.yaml`)
32
- - 乱数: `training.seed: 42`
33
- - 決定性: 既定は `deterministic: false`(高速重視)。厳密再現性が必要なら true を推奨(速度低下に注意)
34
 
35
  ## 動作環境
36
  - OS: Ubuntu 24.04.3 LTS(確認済)
 
1
  # Mecari (Japanese Morphological Analysis with Graph Neural Networks)
2
+ - Demo: https://huggingface.co/spaces/zbller/Mecari
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  ## 概要
5
+ Mecari は、Googleの発表 [1] に着想を得た GNN(Graph Neural Network)ベースの日本語形態素解析器です。MeCab(JUMANDIC)の候補からグラフを構築し、部分アノテーション('+'/'-'、'?'は学習で無視)で学習可能、学習・推論の高速化を重視しています。ノードには JUMAN++ 風のユニグラム特徴量、エッジは無向(双方向)として扱い、GATv2 [2] を学習します。推論ではノードスコアに基づき Viterbi で非重複の最適経路を探索します。
6
 
7
  ## 結果(KWDLC)
8
  - 学習済み(`sample_model`): Seg F1 0.9725, POS F1 0.9562
 
11
  再現メモ
12
  - データ: 公式 KWDLC の `dev.id`/`test.id` 分割を使用
13
  - コンフィグ: `configs/gatv2.yaml`(`extends: base.yaml`)
 
 
14
 
15
  ## 動作環境
16
  - OS: Ubuntu 24.04.3 LTS(確認済)