bareunpy 2.0.0__tar.gz → 2.1.0__tar.gz

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.
Files changed (31) hide show
  1. {bareunpy-2.0.0 → bareunpy-2.1.0}/PKG-INFO +75 -2
  2. {bareunpy-2.0.0 → bareunpy-2.1.0}/README.md +74 -1
  3. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/__init__.py +4 -1
  4. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/_lang_service_client.py +45 -2
  5. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/_tagger.py +168 -20
  6. bareunpy-2.1.0/bareunpy/_version.py +4 -0
  7. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/language_service_connect.py +65 -0
  8. bareunpy-2.1.0/bareunpy/bareun/language_service_pb2.py +76 -0
  9. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/language_service_pb2.pyi +36 -6
  10. {bareunpy-2.0.0 → bareunpy-2.1.0}/pyproject.toml +1 -1
  11. bareunpy-2.0.0/bareunpy/_version.py +0 -4
  12. bareunpy-2.0.0/bareunpy/bareun/language_service_pb2.py +0 -72
  13. {bareunpy-2.0.0 → bareunpy-2.1.0}/LICENSE +0 -0
  14. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/_corrector.py +0 -0
  15. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/_custom_dict.py +0 -0
  16. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/_custom_dict_client.py +0 -0
  17. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/_revision_service_client.py +0 -0
  18. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/_tokenizer.py +0 -0
  19. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/__init__.py +0 -0
  20. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/custom_dict_connect.py +0 -0
  21. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/custom_dict_pb2.py +0 -0
  22. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/custom_dict_pb2.pyi +0 -0
  23. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/dict_common_pb2.py +0 -0
  24. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/dict_common_pb2.pyi +0 -0
  25. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/lang_common_pb2.py +0 -0
  26. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/lang_common_pb2.pyi +0 -0
  27. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/py.typed +0 -0
  28. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/revision_service_connect.py +0 -0
  29. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/revision_service_pb2.py +0 -0
  30. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/bareun/revision_service_pb2.pyi +0 -0
  31. {bareunpy-2.0.0 → bareunpy-2.1.0}/bareunpy/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bareunpy
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: The bareun python library using connect-rpc
5
5
  License: BSD-3-Clause
6
6
  License-File: LICENSE
@@ -46,7 +46,22 @@ Description-Content-Type: text/markdown
46
46
 
47
47
  ---
48
48
 
49
- ## 2.0 변경사항
49
+ ## 변경사항
50
+
51
+ ### 2.1.0
52
+
53
+ - **동형이의어 의미 구분(WSD) API 추가 — 베타**: 표기·품사가 같은데 뜻이 다른 단어(`다리`(橋)/`다리`(脚))를 문맥으로 구분합니다.
54
+ - `tagger.senses('다리를 건넜다.')` — 의미가 부여된 형태소만 `SenseInfo`(어깨번호·뜻풀이·우리말샘 번호·선택 확률) 목록으로 반환
55
+ - `tagger.tag(..., with_sense=True)` / `tags` / `taglist` / `tag_raw` — 분석 결과에 의미를 함께 요청
56
+ - `res.senses()`, `res.pos(sense=True)` — 결과에서 의미 꺼내기(`다리__005/NNG`)
57
+ - 기본값은 모두 `False` 라 **기존 코드의 동작·응답은 그대로**입니다.
58
+ - 베타 기능이며 **바른 3.1.0** 이상 서버가 필요합니다(현재는 api.bareun.ai 에서 사용 가능).
59
+
60
+ ### 2.0.1
61
+
62
+ - **AnalyzeSyntaxRaw API 추가**: `tagger.tag_raw()` — seg+tag 모델 추론만 수행, 복합명사·동사 분해/사용자 사전/자동 띄어쓰기 후처리 없이 순수 모델 출력 반환
63
+
64
+ ### 2.0
50
65
 
51
66
  - **Connect RPC 전환**: `grpcio` 의존성 제거. 공식 [`connectrpc`](https://github.com/connectrpc/connect-python) 라이브러리로 교체
52
67
  - **경량화**: 의존성 2개(`connectrpc`, `protobuf`)만 필요 — 기존 `grpcio` / `connecpy` 설치 불필요
@@ -140,6 +155,63 @@ res = tagger.tags(["안녕하세요.", "반가워요!"])
140
155
  res = tagger.taglist(["안녕하세요.", "반가워요!"])
141
156
  ```
142
157
 
158
+ ### 원시(Raw) 형태소 분석
159
+
160
+ `tag_raw()`는 seg+tag 모델 추론 결과를 후처리 없이 반환합니다. 복합명사·동사 분해, 자동 띄어쓰기·붙여쓰기 보정, 사용자 사전을 적용하지 않아 **순수 모델 출력**을 확인할 때 사용합니다.
161
+
162
+ ```python
163
+ # tag_raw(): 후처리 없는 순수 모델 출력
164
+ res = tagger.tag_raw('나는밥을먹었다')
165
+ print(res.pos())
166
+
167
+ # 문장 자동 분리 적용 가능
168
+ res = tagger.tag_raw('나는밥을먹었다. 그리고잤다.', auto_split=True)
169
+ ```
170
+
171
+ ### 동형이의어 의미 구분 (WSD, 베타)
172
+
173
+ 한국어에는 표기가 같고 뜻이 전혀 다른 단어가 많습니다. `다리`는 건너는 다리(橋)일 수도, 몸의 다리(脚)일 수도 있고 품사는 둘 다 `NNG` 입니다. `senses()` 는 문맥을 보고 **어느 뜻인지**를 어깨번호(사전 의미 번호)와 뜻풀이로 돌려줍니다.
174
+
175
+ ```python
176
+ for s in tagger.senses('다리를 건넜다.'):
177
+ print(s.content, s.tag, s.sense_no, s.meaning)
178
+ # 다리 NNG 5 물을 건너거나 … 건너다닐 수 있도록 만든 시설물.
179
+ # 건너 VV 1 무엇을 사이에 두고 한편에서 맞은편으로 가다.
180
+
181
+ for s in tagger.senses('다리가 저리다.'):
182
+ print(s.content, s.sense_no, s.meaning)
183
+ # 다리 1 사람이나 동물의 몸통 아래 붙어 있는 신체의 부분. …
184
+ ```
185
+
186
+ `SenseInfo` 는 다음 값을 담습니다.
187
+
188
+ | 필드 | 설명 |
189
+ |---|---|
190
+ | `content` / `tag` | 형태소의 표층형과 품사 |
191
+ | `sense_no` | 어깨번호(우리말샘 기준 의미 번호). 사전 표기로는 3자리 0채움(`005`) |
192
+ | `meaning` | 한국어 뜻풀이. **빈 문자열일 수 있습니다**(우리말샘에 표제어가 없는 1% 미만) |
193
+ | `urimal_target_id` / `urimal_url` | 우리말샘 표제어 번호와 그 사전 화면 주소(없으면 0 / 빈 문자열) |
194
+ | `probability` | 후보 의미 중 이 의미를 고른 확률 `[0,1]`. 후보가 하나뿐이면 항상 1.0 |
195
+
196
+ 기존 메서드에 옵션으로 켤 수도 있습니다.
197
+
198
+ ```python
199
+ # 분석 결과 전체를 받고, 그 안에서 의미만 꺼내기
200
+ res = tagger.tag('다리를 건넜다.', with_sense=True)
201
+ print(res.senses()) # SenseInfo 목록
202
+ print(res.pos(join=True, sense=True)) # ['다리__005/NNG', '를/JKO', '건너__001/VV', ...]
203
+ print(res.pos(sense=True)) # [('다리','NNG',5), ('를','JKO',0), ...]
204
+
205
+ # 여러 문장·원시 분석에서도 동일하게 동작합니다.
206
+ tagger.tags(['다리를 건넜다.', '다리가 저리다.'], with_sense=True)
207
+ tagger.taglist(['다리를 건넜다.'], with_sense=True)
208
+ tagger.tag_raw('다리를건넜다', with_sense=True)
209
+ ```
210
+
211
+ > **베타 안내** — 의미 구분은 베타 기능이며 **바른 3.1.0** 이상 서버가 필요합니다(현재 api.bareun.ai 에서 사용 가능).
212
+ > 명사와 문맥 단서가 분명한 문장에서 잘 동작하고, 동사·형용사나 한 문장에 같은 표기가 여러 번 나오는 경우에는 오류가 있을 수 있습니다.
213
+ > 의미가 없는 형태소(조사·어미 등)는 `senses()` 결과에 나오지 않으며, `with_sense` 를 켜지 않으면 응답·처리 시간이 종전과 동일합니다.
214
+
143
215
  ### 분석 옵션
144
216
 
145
217
  `tag()`, `tags()`, `taglist()` 메서드에서 다음 옵션을 사용할 수 있습니다.
@@ -149,6 +221,7 @@ res = tagger.taglist(["안녕하세요.", "반가워요!"])
149
221
  | `auto_split` | bool | `False` | 문장 자동 분리 (`tag`, `tags`만 해당) |
150
222
  | `auto_spacing` | bool | `True` | 띄어쓰기 보정 |
151
223
  | `auto_jointing` | bool | `True` | 붙여쓰기 보정 |
224
+ | `with_sense` | bool | `False` | 동형이의어 의미 구분(WSD, 베타) 결과 포함 — `tag_raw()` 에서도 사용 가능 |
152
225
 
153
226
  ```python
154
227
  res = tagger.tag('햇빛이선명하게나뭇잎을핥고있었다', auto_spacing=True, auto_jointing=True)
@@ -6,7 +6,22 @@
6
6
 
7
7
  ---
8
8
 
9
- ## 2.0 변경사항
9
+ ## 변경사항
10
+
11
+ ### 2.1.0
12
+
13
+ - **동형이의어 의미 구분(WSD) API 추가 — 베타**: 표기·품사가 같은데 뜻이 다른 단어(`다리`(橋)/`다리`(脚))를 문맥으로 구분합니다.
14
+ - `tagger.senses('다리를 건넜다.')` — 의미가 부여된 형태소만 `SenseInfo`(어깨번호·뜻풀이·우리말샘 번호·선택 확률) 목록으로 반환
15
+ - `tagger.tag(..., with_sense=True)` / `tags` / `taglist` / `tag_raw` — 분석 결과에 의미를 함께 요청
16
+ - `res.senses()`, `res.pos(sense=True)` — 결과에서 의미 꺼내기(`다리__005/NNG`)
17
+ - 기본값은 모두 `False` 라 **기존 코드의 동작·응답은 그대로**입니다.
18
+ - 베타 기능이며 **바른 3.1.0** 이상 서버가 필요합니다(현재는 api.bareun.ai 에서 사용 가능).
19
+
20
+ ### 2.0.1
21
+
22
+ - **AnalyzeSyntaxRaw API 추가**: `tagger.tag_raw()` — seg+tag 모델 추론만 수행, 복합명사·동사 분해/사용자 사전/자동 띄어쓰기 후처리 없이 순수 모델 출력 반환
23
+
24
+ ### 2.0
10
25
 
11
26
  - **Connect RPC 전환**: `grpcio` 의존성 제거. 공식 [`connectrpc`](https://github.com/connectrpc/connect-python) 라이브러리로 교체
12
27
  - **경량화**: 의존성 2개(`connectrpc`, `protobuf`)만 필요 — 기존 `grpcio` / `connecpy` 설치 불필요
@@ -100,6 +115,63 @@ res = tagger.tags(["안녕하세요.", "반가워요!"])
100
115
  res = tagger.taglist(["안녕하세요.", "반가워요!"])
101
116
  ```
102
117
 
118
+ ### 원시(Raw) 형태소 분석
119
+
120
+ `tag_raw()`는 seg+tag 모델 추론 결과를 후처리 없이 반환합니다. 복합명사·동사 분해, 자동 띄어쓰기·붙여쓰기 보정, 사용자 사전을 적용하지 않아 **순수 모델 출력**을 확인할 때 사용합니다.
121
+
122
+ ```python
123
+ # tag_raw(): 후처리 없는 순수 모델 출력
124
+ res = tagger.tag_raw('나는밥을먹었다')
125
+ print(res.pos())
126
+
127
+ # 문장 자동 분리 적용 가능
128
+ res = tagger.tag_raw('나는밥을먹었다. 그리고잤다.', auto_split=True)
129
+ ```
130
+
131
+ ### 동형이의어 의미 구분 (WSD, 베타)
132
+
133
+ 한국어에는 표기가 같고 뜻이 전혀 다른 단어가 많습니다. `다리`는 건너는 다리(橋)일 수도, 몸의 다리(脚)일 수도 있고 품사는 둘 다 `NNG` 입니다. `senses()` 는 문맥을 보고 **어느 뜻인지**를 어깨번호(사전 의미 번호)와 뜻풀이로 돌려줍니다.
134
+
135
+ ```python
136
+ for s in tagger.senses('다리를 건넜다.'):
137
+ print(s.content, s.tag, s.sense_no, s.meaning)
138
+ # 다리 NNG 5 물을 건너거나 … 건너다닐 수 있도록 만든 시설물.
139
+ # 건너 VV 1 무엇을 사이에 두고 한편에서 맞은편으로 가다.
140
+
141
+ for s in tagger.senses('다리가 저리다.'):
142
+ print(s.content, s.sense_no, s.meaning)
143
+ # 다리 1 사람이나 동물의 몸통 아래 붙어 있는 신체의 부분. …
144
+ ```
145
+
146
+ `SenseInfo` 는 다음 값을 담습니다.
147
+
148
+ | 필드 | 설명 |
149
+ |---|---|
150
+ | `content` / `tag` | 형태소의 표층형과 품사 |
151
+ | `sense_no` | 어깨번호(우리말샘 기준 의미 번호). 사전 표기로는 3자리 0채움(`005`) |
152
+ | `meaning` | 한국어 뜻풀이. **빈 문자열일 수 있습니다**(우리말샘에 표제어가 없는 1% 미만) |
153
+ | `urimal_target_id` / `urimal_url` | 우리말샘 표제어 번호와 그 사전 화면 주소(없으면 0 / 빈 문자열) |
154
+ | `probability` | 후보 의미 중 이 의미를 고른 확률 `[0,1]`. 후보가 하나뿐이면 항상 1.0 |
155
+
156
+ 기존 메서드에 옵션으로 켤 수도 있습니다.
157
+
158
+ ```python
159
+ # 분석 결과 전체를 받고, 그 안에서 의미만 꺼내기
160
+ res = tagger.tag('다리를 건넜다.', with_sense=True)
161
+ print(res.senses()) # SenseInfo 목록
162
+ print(res.pos(join=True, sense=True)) # ['다리__005/NNG', '를/JKO', '건너__001/VV', ...]
163
+ print(res.pos(sense=True)) # [('다리','NNG',5), ('를','JKO',0), ...]
164
+
165
+ # 여러 문장·원시 분석에서도 동일하게 동작합니다.
166
+ tagger.tags(['다리를 건넜다.', '다리가 저리다.'], with_sense=True)
167
+ tagger.taglist(['다리를 건넜다.'], with_sense=True)
168
+ tagger.tag_raw('다리를건넜다', with_sense=True)
169
+ ```
170
+
171
+ > **베타 안내** — 의미 구분은 베타 기능이며 **바른 3.1.0** 이상 서버가 필요합니다(현재 api.bareun.ai 에서 사용 가능).
172
+ > 명사와 문맥 단서가 분명한 문장에서 잘 동작하고, 동사·형용사나 한 문장에 같은 표기가 여러 번 나오는 경우에는 오류가 있을 수 있습니다.
173
+ > 의미가 없는 형태소(조사·어미 등)는 `senses()` 결과에 나오지 않으며, `with_sense` 를 켜지 않으면 응답·처리 시간이 종전과 동일합니다.
174
+
103
175
  ### 분석 옵션
104
176
 
105
177
  `tag()`, `tags()`, `taglist()` 메서드에서 다음 옵션을 사용할 수 있습니다.
@@ -109,6 +181,7 @@ res = tagger.taglist(["안녕하세요.", "반가워요!"])
109
181
  | `auto_split` | bool | `False` | 문장 자동 분리 (`tag`, `tags`만 해당) |
110
182
  | `auto_spacing` | bool | `True` | 띄어쓰기 보정 |
111
183
  | `auto_jointing` | bool | `True` | 붙여쓰기 보정 |
184
+ | `with_sense` | bool | `False` | 동형이의어 의미 구분(WSD, 베타) 결과 포함 — `tag_raw()` 에서도 사용 가능 |
112
185
 
113
186
  ```python
114
187
  res = tagger.tag('햇빛이선명하게나뭇잎을핥고있었다', auto_spacing=True, auto_jointing=True)
@@ -28,6 +28,9 @@ Tagger
28
28
  Tagged
29
29
  Wrapper for tagged output
30
30
  `from bareunpy import Tagged`
31
+ SenseInfo
32
+ 동형이의어 의미 구분(WSD, 베타) 결과 한 건
33
+ `from bareunpy import SenseInfo`
31
34
  CustomDict
32
35
  Custom dictionary for Korean.
33
36
  `from bareunpy import CustomDict`
@@ -49,7 +52,7 @@ Get bareun
49
52
  import sys
50
53
  import os
51
54
 
52
- from bareunpy._tagger import Tagger, Tagged
55
+ from bareunpy._tagger import Tagger, Tagged, SenseInfo
53
56
  from bareunpy._tokenizer import Tokenizer, Tokenized
54
57
  from bareunpy._corrector import Corrector
55
58
  from bareunpy._custom_dict import CustomDict
@@ -140,7 +140,8 @@ class BareunLanguageServiceClient:
140
140
  custom_dicts: Optional[List[str]] = None,
141
141
  auto_split: bool = False,
142
142
  auto_spacing: bool = True,
143
- auto_jointing: bool = True) -> pb.AnalyzeSyntaxResponse:
143
+ auto_jointing: bool = True,
144
+ with_sense: bool = False) -> pb.AnalyzeSyntaxResponse:
144
145
  """형태소 분석을 수행합니다.
145
146
 
146
147
  Args:
@@ -149,6 +150,10 @@ class BareunLanguageServiceClient:
149
150
  auto_split (bool): 문장 자동 분리 여부, 기본값은 사용하지 않음.
150
151
  auto_spacing (bool): 띄어쓰기 보정 기능, 기본값은 사용하도록 함.
151
152
  auto_jointing (bool): 붙여쓰기 보정 기능, 기본값은 사용하도록 함.
153
+ with_sense (bool): 동형이의어 의미 구분(WSD, 베타) 결과를 함께 받을지 여부.
154
+ 기본값 False. True 로 주면 응답 형태소에 ``sense``(어깨번호·뜻풀이·우리말샘
155
+ 번호·선택 확률)가 실립니다. 서버에서 추론이 한 번 더 일어나므로 필요할 때만
156
+ 켜세요. False 면 응답·비용이 종전과 동일합니다.
152
157
 
153
158
  Raises:
154
159
  Exception: 원격 호출시 예외가 발생할 수 있습니다.
@@ -163,6 +168,7 @@ class BareunLanguageServiceClient:
163
168
  req.auto_split_sentence = auto_split
164
169
  req.auto_spacing = auto_spacing
165
170
  req.auto_jointing = auto_jointing
171
+ req.with_sense = with_sense
166
172
  if custom_dicts:
167
173
  req.custom_dict_names.extend(custom_dicts)
168
174
 
@@ -171,10 +177,44 @@ class BareunLanguageServiceClient:
171
177
  except ConnectError as e:
172
178
  self._handle_connect_error(e)
173
179
 
180
+ def analyze_syntax_raw(self, content: str,
181
+ auto_split: bool = False,
182
+ with_sense: bool = False) -> pb.AnalyzeSyntaxResponse:
183
+ """모델 추론만 수행하는 원시(raw) 형태소 분석을 수행합니다.
184
+
185
+ 복합명사·동사 분해, 자동 띄어쓰기·붙여쓰기 보정, 사용자 사전을 일절 적용하지 않습니다.
186
+ seg+tag 모델 추론 결과를 그대로 반환하므로, 후처리 없는 순수 모델 출력이 필요할 때
187
+ 사용합니다. 응답 형식은 ``AnalyzeSyntaxResponse`` 로 ``analyze_syntax`` 와 동일합니다.
188
+
189
+ Args:
190
+ content (str): 형태소 분석할 원문. 여러 문장은 개행문자로 구분합니다.
191
+ auto_split (bool): 문장 자동 분리 여부. 기본값은 False(개행 기준으로 분리).
192
+ with_sense (bool): 동형이의어 의미 구분(WSD, 베타) 결과를 함께 받을지 여부.
193
+ 기본값 False. 의미도 후처리 없이 모델 출력 그대로 실립니다.
194
+
195
+ Raises:
196
+ Exception: 원격 호출시 예외가 발생할 수 있습니다.
197
+
198
+ Returns:
199
+ pb.AnalyzeSyntaxResponse: 원시 모델 추론 형태소 분석 결과
200
+ """
201
+ req = pb.AnalyzeSyntaxRawRequest()
202
+ req.document.content = content
203
+ req.document.language = "ko_KR"
204
+ req.encoding_type = lpb.EncodingType.UTF32
205
+ req.auto_split_sentence = auto_split
206
+ req.with_sense = with_sense
207
+
208
+ try:
209
+ return self.stub.analyze_syntax_raw(req, headers=self.metadata)
210
+ except ConnectError as e:
211
+ self._handle_connect_error(e)
212
+
174
213
  def analyze_syntax_list(self, content: List[str],
175
214
  custom_dicts: Optional[List[str]] = None,
176
215
  auto_spacing: bool = True,
177
- auto_jointing: bool = True) -> pb.AnalyzeSyntaxListResponse:
216
+ auto_jointing: bool = True,
217
+ with_sense: bool = False) -> pb.AnalyzeSyntaxListResponse:
178
218
  """형태소 분석을 수행하되, 입력된 문장 단위가 일치하도록 반환됩니다.
179
219
 
180
220
  문장 분할 기능을 사용하지 않습니다.
@@ -184,6 +224,8 @@ class BareunLanguageServiceClient:
184
224
  custom_dicts (Optional[List[str]]): 사용자 사전의 이름 목록. 기본값은 None(사용 안 함).
185
225
  auto_spacing (bool): 띄어쓰기 보정 기능, 기본값은 사용하도록 함.
186
226
  auto_jointing (bool): 붙여쓰기 보정 기능, 기본값은 사용하도록 함.
227
+ with_sense (bool): 동형이의어 의미 구분(WSD, 베타) 결과를 함께 받을지 여부.
228
+ 기본값 False.
187
229
 
188
230
  Raises:
189
231
  Exception: 원격 호출시 예외가 발생할 수 있습니다.
@@ -197,6 +239,7 @@ class BareunLanguageServiceClient:
197
239
  req.encoding_type = lpb.EncodingType.UTF32
198
240
  req.auto_spacing = auto_spacing
199
241
  req.auto_jointing = auto_jointing
242
+ req.with_sense = with_sense
200
243
  if custom_dicts:
201
244
  req.custom_dict_names.extend(custom_dicts)
202
245
 
@@ -2,13 +2,49 @@
2
2
  import json
3
3
  import warnings
4
4
  from sys import stdout
5
- from typing import IO, List, Optional, Union
5
+ from typing import IO, List, NamedTuple, Optional, Union
6
6
 
7
7
  from google.protobuf.json_format import MessageToDict
8
8
  from bareunpy._custom_dict import CustomDict
9
9
  from bareunpy._lang_service_client import BareunLanguageServiceClient
10
10
  from bareunpy.bareun.language_service_pb2 import AnalyzeSyntaxResponse, AnalyzeSyntaxListResponse, Morpheme, Sentence, Token
11
11
 
12
+
13
+ class SenseInfo(NamedTuple):
14
+ """동형이의어 의미 구분(WSD, 베타) 결과 한 건.
15
+
16
+ ``Tagged.senses()`` / ``Tagger.senses()`` 가 돌려주는 항목이다. 형태소 하나에 대해
17
+ "표기·품사는 같은데 뜻이 다른 단어들" 중 어떤 뜻으로 판정됐는지를 담는다.
18
+
19
+ Attributes:
20
+ content (str): 형태소의 표층형(예: ``다리``).
21
+ tag (str): 품사 태그 이름(예: ``NNG``).
22
+ sense_no (int): 어깨번호. 우리말샘 기준 의미 번호(예: 5). 사전 표기로 되돌리려면
23
+ 3자리 0채움(``005``)으로 만든다.
24
+ meaning (str): 한국어 뜻풀이. **빈 문자열일 수 있다** — 우리말샘에 표제어가 없는
25
+ 경우가 1% 미만 존재한다.
26
+ urimal_target_id (int): 우리말샘 표제어 고유 번호. 0 이면 미부여.
27
+ ``https://opendict.korean.go.kr/dictionary/view?sense_no=<값>`` 으로 열 수 있다.
28
+ probability (float): 그 의미를 고른 확률 [0,1]. **후보 의미 집합 안에서** 정규화한
29
+ 값이라 후보를 모두 더하면 1 이다. 후보가 하나뿐인 단어는 항상 1.0 이므로
30
+ "확신"이 아니라 "고를 것이 하나뿐"이라는 뜻이다. 형태소의 ``probability``
31
+ (품사 점수)와는 척도가 달라 같은 임계값으로 비교하면 안 된다.
32
+ """
33
+
34
+ content: str
35
+ tag: str
36
+ sense_no: int
37
+ meaning: str
38
+ urimal_target_id: int
39
+ probability: float
40
+
41
+ @property
42
+ def urimal_url(self) -> str:
43
+ """우리말샘 표제어 화면 주소. ``urimal_target_id`` 가 0이면 빈 문자열."""
44
+ if not self.urimal_target_id:
45
+ return ""
46
+ return f"https://opendict.korean.go.kr/dictionary/view?sense_no={self.urimal_target_id}"
47
+
12
48
  def _resolve_port(host: str, port: Optional[int]) -> int:
13
49
  """
14
50
  Resolve port number based on host.
@@ -85,39 +121,91 @@ class Tagged:
85
121
  json.dump(d, out, ensure_ascii=False, indent=2)
86
122
 
87
123
  @staticmethod
88
- def _pos(m: Morpheme, join: bool, detail: bool):
124
+ def _sense_no(m: Morpheme) -> int:
125
+ """형태소에 부여된 어깨번호를 돌려줍니다(없으면 0).
126
+
127
+ ``sense`` 는 proto3 ``optional`` 메시지 필드라, 의미가 부여되지 않은 형태소
128
+ (조사·어미 등, 또는 ``with_sense`` 를 켜지 않은 호출 전체)에는 필드 자체가 없습니다.
129
+ 그래서 값 비교가 아니라 ``HasField`` 로 존재를 확인합니다.
130
+ """
131
+ return m.sense.sense_no if m.HasField("sense") else 0
132
+
133
+ @staticmethod
134
+ def _pos(m: Morpheme, join: bool, detail: bool, sense: bool = False):
135
+ sense_no = Tagged._sense_no(m) if sense else 0
89
136
  if join:
137
+ # 어깨번호가 있으면 말뭉치·문서와 같은 `표층형__NNN` 표기로 덧붙인다.
138
+ content = f'{m.text.content}__{sense_no:03d}' if sense_no else m.text.content
90
139
  if detail:
91
140
  p = f':{m.probability:5.3f}' if m.probability > 0 else ''
92
141
  oov = f'#{Morpheme.OutOfVocab.Name(m.out_of_vocab)}' if m.out_of_vocab != 0 else ''
93
- return f'{m.text.content}/{Morpheme.Tag.Name(m.tag)}{p}{oov}'
142
+ return f'{content}/{Morpheme.Tag.Name(m.tag)}{p}{oov}'
94
143
  else:
95
- return f'{m.text.content}/{Morpheme.Tag.Name(m.tag)}'
144
+ return f'{content}/{Morpheme.Tag.Name(m.tag)}'
96
145
  else:
97
146
  if detail:
98
- return m.text.content,\
99
- Morpheme.Tag.Name(m.tag),\
100
- Morpheme.OutOfVocab.Name(m.out_of_vocab),\
101
- m.probability
147
+ base = (m.text.content,
148
+ Morpheme.Tag.Name(m.tag),
149
+ Morpheme.OutOfVocab.Name(m.out_of_vocab),
150
+ m.probability)
102
151
  else:
103
- return m.text.content, Morpheme.Tag.Name(m.tag)
152
+ base = (m.text.content, Morpheme.Tag.Name(m.tag))
153
+ # sense=True 면 튜플 끝에 어깨번호를 하나 더 붙인다(미부여는 0).
154
+ return base + (sense_no,) if sense else base
104
155
 
105
- def pos(self, flatten: bool = True, join: bool = False, detail: bool = False) -> List:
156
+ def pos(self, flatten: bool = True, join: bool = False, detail: bool = False,
157
+ sense: bool = False) -> List:
106
158
  """
107
159
  POS tagger to tuple.
108
160
  :param flatten : If False, returns original morphs.
109
161
  :param join : If True, returns joined sets of morph and tag.
110
162
  :param detail : if True, returns everything of morph result
163
+ :param sense : if True, 동형이의어 어깨번호를 함께 표기합니다(WSD, 베타).
164
+ join=True 면 `다리__005/NNG` 형태로, join=False 면 튜플 끝에
165
+ 어깨번호(미부여는 0)가 추가됩니다. 분석 요청 시
166
+ `with_sense=True` 로 호출했을 때만 값이 채워집니다.
111
167
  """
112
168
  if flatten:
113
- return [Tagged._pos(m, join, detail) for s in self.r.sentences
169
+ return [Tagged._pos(m, join, detail, sense) for s in self.r.sentences
114
170
  for token in s.tokens
115
171
  for m in token.morphemes]
116
172
  else:
117
- return [[Tagged._pos(m, join, detail) for m in token.morphemes]
173
+ return [[Tagged._pos(m, join, detail, sense) for m in token.morphemes]
118
174
  for s in self.r.sentences
119
175
  for token in s.tokens]
120
176
 
177
+ def senses(self, flatten: bool = True) -> List:
178
+ """동형이의어 의미 구분(WSD, 베타) 결과만 골라서 돌려줍니다.
179
+
180
+ 의미가 **부여된 형태소만** 나옵니다. 조사·어미처럼 사전 의미 번호가 없는 형태소는
181
+ 빠지므로, 결과가 형태소 목록보다 짧은 것이 정상입니다. 분석을 ``with_sense=True``
182
+ 로 요청하지 않았다면 빈 목록입니다.
183
+
184
+ :param flatten: True(기본)면 형태소 단위로 평탄한 목록, False 면 어절별 목록의 목록.
185
+ :return: :class:`SenseInfo` 의 목록(또는 목록의 목록)
186
+ """
187
+ if flatten:
188
+ return [Tagged._sense_info(m) for s in self.r.sentences
189
+ for token in s.tokens
190
+ for m in token.morphemes
191
+ if m.HasField("sense")]
192
+ else:
193
+ return [[Tagged._sense_info(m) for m in token.morphemes if m.HasField("sense")]
194
+ for s in self.r.sentences
195
+ for token in s.tokens]
196
+
197
+ @staticmethod
198
+ def _sense_info(m: Morpheme) -> SenseInfo:
199
+ """의미가 부여된 형태소를 :class:`SenseInfo` 로 바꿉니다(호출 전 존재 확인 필요)."""
200
+ return SenseInfo(
201
+ content=m.text.content,
202
+ tag=Morpheme.Tag.Name(m.tag),
203
+ sense_no=m.sense.sense_no,
204
+ meaning=m.sense.meaning,
205
+ urimal_target_id=m.sense.urimal_target_id,
206
+ probability=m.sense.probability,
207
+ )
208
+
121
209
  def morphs(self) -> List:
122
210
  """Parse phrase to morphemes."""
123
211
  return [m.text.content for s in self.r.sentences
@@ -214,53 +302,113 @@ class Tagger:
214
302
  self.internal_custom_dicts[name] = CustomDict(self.apikey, name, self.host, self.port)
215
303
  return self.internal_custom_dicts[name]
216
304
 
217
- def tag(self, phrase: str, auto_split: bool = False, auto_spacing: bool = True, auto_jointing: bool = True) -> Tagged:
305
+ def tag_raw(self, phrase: str, auto_split: bool = False, with_sense: bool = False) -> Tagged:
306
+ """모델 추론만 수행하는 원시(raw) 형태소 분석을 수행합니다.
307
+
308
+ 복합명사·동사 분해, 자동 띄어쓰기·붙여쓰기 보정, 사용자 사전을 일절 적용하지 않습니다.
309
+ seg+tag 모델의 순수 추론 결과가 필요할 때 사용합니다.
310
+
311
+ :param phrase: 분석할 문자열
312
+ :param auto_split: 문장 자동 분리 여부 (기본값: False)
313
+ :param with_sense: 동형이의어 의미 구분(WSD, 베타) 결과를 함께 받을지 여부 (기본값: False)
314
+ :return: Tagged result instance
315
+ """
316
+ if len(phrase) == 0:
317
+ print("OOPS, no sentences.")
318
+ return Tagged('', AnalyzeSyntaxResponse())
319
+ res = self.client.analyze_syntax_raw(phrase, auto_split=auto_split, with_sense=with_sense)
320
+ return Tagged(phrase, res)
321
+
322
+ def tag(self, phrase: str, auto_split: bool = False, auto_spacing: bool = True,
323
+ auto_jointing: bool = True, with_sense: bool = False) -> Tagged:
324
+ """형태소 분석을 수행합니다.
325
+
326
+ :param phrase: 분석할 문자열
327
+ :param auto_split: 문장 자동 분리 여부 (기본값: False)
328
+ :param auto_spacing: 띄어쓰기 보정 기능 (기본값: True)
329
+ :param auto_jointing: 붙여쓰기 보정 기능 (기본값: True)
330
+ :param with_sense: 동형이의어 의미 구분(WSD, 베타) 결과를 함께 받을지 여부 (기본값: False).
331
+ 켜면 결과에서 :meth:`Tagged.senses` 로 어깨번호·뜻풀이를 꺼낼 수 있습니다.
332
+ :return: Tagged result instance
333
+ """
218
334
  if len(phrase) == 0:
219
335
  print("OOPS, no sentences.")
220
336
  return Tagged('', AnalyzeSyntaxResponse())
221
337
  # 에러 변환은 BareunLanguageServiceClient 내부에서 처리하므로 여기서 직접 호출한다.
222
- res = self.client.analyze_syntax(phrase, self.custom_dicts, auto_split=auto_split, auto_spacing=auto_spacing, auto_jointing=auto_jointing)
338
+ res = self.client.analyze_syntax(phrase, self.custom_dicts, auto_split=auto_split,
339
+ auto_spacing=auto_spacing, auto_jointing=auto_jointing,
340
+ with_sense=with_sense)
223
341
  return Tagged(phrase, res)
224
342
 
225
- def tags(self, phrase: List[str], auto_split: bool = False, auto_spacing: bool = True, auto_jointing: bool = True) -> Tagged:
343
+ def tags(self, phrase: List[str], auto_split: bool = False, auto_spacing: bool = True,
344
+ auto_jointing: bool = True, with_sense: bool = False) -> Tagged:
226
345
  """
227
346
  tag string array.
228
347
  :param phrase: array of string
229
348
  :param auto_split(bool, optional): Whether to automatically perform sentence split
230
349
  :param auto_spacing(bool, optional): Whether to automatically perform space insertion for typo correction
231
350
  :param auto_jointing(bool, optional): Whether to automatically perform word joining for typo correction
351
+ :param with_sense(bool, optional): 동형이의어 의미 구분(WSD, 베타) 결과 포함 여부
232
352
  :return: Tagged result instance
233
353
  """
234
354
  if len(phrase) == 0:
235
355
  print("OOPS, no sentences.")
236
356
  return Tagged('', AnalyzeSyntaxResponse())
237
357
  p = '\n'.join(phrase)
238
- res = self.client.analyze_syntax(p, self.custom_dicts, auto_split=auto_split, auto_spacing=auto_spacing, auto_jointing=auto_jointing)
358
+ res = self.client.analyze_syntax(p, self.custom_dicts, auto_split=auto_split,
359
+ auto_spacing=auto_spacing, auto_jointing=auto_jointing,
360
+ with_sense=with_sense)
239
361
  return Tagged(p, res)
240
362
 
241
- def taglist(self, phrase: List[str], auto_spacing: bool = True, auto_jointing: bool = True) -> Tagged:
363
+ def taglist(self, phrase: List[str], auto_spacing: bool = True, auto_jointing: bool = True,
364
+ with_sense: bool = False) -> Tagged:
242
365
  """
243
366
  문장 분할 없이 입력된 문장 단위 그대로 형태소 분석을 수행합니다.
244
367
  :param phrase: 분석할 문장의 리스트
245
368
  :param auto_spacing(bool, optional): 띄어쓰기 보정 기능 (기본값: True)
246
369
  :param auto_jointing(bool, optional): 붙여쓰기 보정 기능 (기본값: True)
370
+ :param with_sense(bool, optional): 동형이의어 의미 구분(WSD, 베타) 결과 포함 여부
247
371
  :return: Tagged result instance
248
372
  """
249
373
  if len(phrase) == 0:
250
374
  print("OOPS, no sentences.")
251
375
  return Tagged('', AnalyzeSyntaxListResponse())
252
- res = self.client.analyze_syntax_list(phrase, self.custom_dicts, auto_spacing=auto_spacing, auto_jointing=auto_jointing)
376
+ res = self.client.analyze_syntax_list(phrase, self.custom_dicts, auto_spacing=auto_spacing,
377
+ auto_jointing=auto_jointing, with_sense=with_sense)
253
378
  return Tagged(phrase, res)
254
379
 
255
- def pos(self, phrase: str, flatten: bool = True, join: bool = False, detail: bool = False) -> List:
380
+ def pos(self, phrase: str, flatten: bool = True, join: bool = False, detail: bool = False,
381
+ sense: bool = False) -> List:
256
382
  """
257
383
  POS tagger.
258
384
  :param phrase : string to analyse
259
385
  :param flatten : If False, returns original morphs.
260
386
  :param join : If True, returns joined sets of morph and tag.
261
387
  :param detail : if True, returns every things of morph result
388
+ :param sense : if True, 동형이의어 어깨번호를 함께 표기합니다(WSD, 베타).
389
+ 이 값이 True 면 분석 요청도 자동으로 `with_sense=True` 로 보냅니다.
390
+ """
391
+ return self.tag(phrase, with_sense=sense).pos(flatten, join, detail, sense)
392
+
393
+ def senses(self, phrase: str, auto_split: bool = False) -> List:
394
+ """동형이의어 의미 구분(WSD, 베타) 결과만 바로 얻습니다.
395
+
396
+ 내부적으로 ``with_sense=True`` 로 형태소 분석을 수행한 뒤, 의미가 부여된 형태소만
397
+ :class:`SenseInfo` 목록으로 돌려줍니다.
398
+
399
+ .. code-block:: python
400
+ >>> import bareunpy as brn
401
+ >>> t = brn.Tagger(apikey="koba-YOURKEY")
402
+ >>> for s in t.senses('다리를 건넜다.'):
403
+ ... print(s.content, s.tag, s.sense_no, s.meaning)
404
+ 다리 NNG 5 물을 건너거나 ... 만든 시설물.
405
+ 건너 VV 1 무엇을 사이에 두고 한편에서 맞은편으로 가다.
406
+
407
+ :param phrase: 분석할 문자열
408
+ :param auto_split: 문장 자동 분리 여부 (기본값: False)
409
+ :return: :class:`SenseInfo` 의 목록
262
410
  """
263
- return self.tag(phrase).pos(flatten, join, detail)
411
+ return self.tag(phrase, auto_split=auto_split, with_sense=True).senses()
264
412
 
265
413
  def morphs(self, phrase: str) -> List:
266
414
  """Parse phrase to morphemes."""
@@ -0,0 +1,4 @@
1
+
2
+ version = "2.1.0"
3
+ bareun_version = "3.1.0"
4
+
@@ -24,6 +24,9 @@ class LanguageService(Protocol):
24
24
  async def analyze_syntax_list(self, request: bareun_dot_language__service__pb2.AnalyzeSyntaxListRequest, ctx: RequestContext) -> bareun_dot_language__service__pb2.AnalyzeSyntaxListResponse:
25
25
  raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
26
26
 
27
+ async def analyze_syntax_raw(self, request: bareun_dot_language__service__pb2.AnalyzeSyntaxRawRequest, ctx: RequestContext) -> bareun_dot_language__service__pb2.AnalyzeSyntaxResponse:
28
+ raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
29
+
27
30
  async def tokenize(self, request: bareun_dot_language__service__pb2.TokenizeRequest, ctx: RequestContext) -> bareun_dot_language__service__pb2.TokenizeResponse:
28
31
  raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
29
32
 
@@ -53,6 +56,16 @@ class LanguageServiceASGIApplication(ConnectASGIApplication[LanguageService]):
53
56
  ),
54
57
  function=svc.analyze_syntax_list,
55
58
  ),
59
+ "/bareun.LanguageService/AnalyzeSyntaxRaw": Endpoint.unary(
60
+ method=MethodInfo(
61
+ name="AnalyzeSyntaxRaw",
62
+ service_name="bareun.LanguageService",
63
+ input=bareun_dot_language__service__pb2.AnalyzeSyntaxRawRequest,
64
+ output=bareun_dot_language__service__pb2.AnalyzeSyntaxResponse,
65
+ idempotency_level=IdempotencyLevel.UNKNOWN,
66
+ ),
67
+ function=svc.analyze_syntax_raw,
68
+ ),
56
69
  "/bareun.LanguageService/Tokenize": Endpoint.unary(
57
70
  method=MethodInfo(
58
71
  name="Tokenize",
@@ -117,6 +130,26 @@ class LanguageServiceClient(ConnectClient):
117
130
  timeout_ms=timeout_ms,
118
131
  )
119
132
 
133
+ async def analyze_syntax_raw(
134
+ self,
135
+ request: bareun_dot_language__service__pb2.AnalyzeSyntaxRawRequest,
136
+ *,
137
+ headers: Headers | Mapping[str, str] | None = None,
138
+ timeout_ms: int | None = None,
139
+ ) -> bareun_dot_language__service__pb2.AnalyzeSyntaxResponse:
140
+ return await self.execute_unary(
141
+ request=request,
142
+ method=MethodInfo(
143
+ name="AnalyzeSyntaxRaw",
144
+ service_name="bareun.LanguageService",
145
+ input=bareun_dot_language__service__pb2.AnalyzeSyntaxRawRequest,
146
+ output=bareun_dot_language__service__pb2.AnalyzeSyntaxResponse,
147
+ idempotency_level=IdempotencyLevel.UNKNOWN,
148
+ ),
149
+ headers=headers,
150
+ timeout_ms=timeout_ms,
151
+ )
152
+
120
153
  async def tokenize(
121
154
  self,
122
155
  request: bareun_dot_language__service__pb2.TokenizeRequest,
@@ -146,6 +179,8 @@ class LanguageServiceSync(Protocol):
146
179
  raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
147
180
  def analyze_syntax_list(self, request: bareun_dot_language__service__pb2.AnalyzeSyntaxListRequest, ctx: RequestContext) -> bareun_dot_language__service__pb2.AnalyzeSyntaxListResponse:
148
181
  raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
182
+ def analyze_syntax_raw(self, request: bareun_dot_language__service__pb2.AnalyzeSyntaxRawRequest, ctx: RequestContext) -> bareun_dot_language__service__pb2.AnalyzeSyntaxResponse:
183
+ raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
149
184
  def tokenize(self, request: bareun_dot_language__service__pb2.TokenizeRequest, ctx: RequestContext) -> bareun_dot_language__service__pb2.TokenizeResponse:
150
185
  raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
151
186
 
@@ -174,6 +209,16 @@ class LanguageServiceWSGIApplication(ConnectWSGIApplication):
174
209
  ),
175
210
  function=service.analyze_syntax_list,
176
211
  ),
212
+ "/bareun.LanguageService/AnalyzeSyntaxRaw": EndpointSync.unary(
213
+ method=MethodInfo(
214
+ name="AnalyzeSyntaxRaw",
215
+ service_name="bareun.LanguageService",
216
+ input=bareun_dot_language__service__pb2.AnalyzeSyntaxRawRequest,
217
+ output=bareun_dot_language__service__pb2.AnalyzeSyntaxResponse,
218
+ idempotency_level=IdempotencyLevel.UNKNOWN,
219
+ ),
220
+ function=service.analyze_syntax_raw,
221
+ ),
177
222
  "/bareun.LanguageService/Tokenize": EndpointSync.unary(
178
223
  method=MethodInfo(
179
224
  name="Tokenize",
@@ -238,6 +283,26 @@ class LanguageServiceClientSync(ConnectClientSync):
238
283
  timeout_ms=timeout_ms,
239
284
  )
240
285
 
286
+ def analyze_syntax_raw(
287
+ self,
288
+ request: bareun_dot_language__service__pb2.AnalyzeSyntaxRawRequest,
289
+ *,
290
+ headers: Headers | Mapping[str, str] | None = None,
291
+ timeout_ms: int | None = None,
292
+ ) -> bareun_dot_language__service__pb2.AnalyzeSyntaxResponse:
293
+ return self.execute_unary(
294
+ request=request,
295
+ method=MethodInfo(
296
+ name="AnalyzeSyntaxRaw",
297
+ service_name="bareun.LanguageService",
298
+ input=bareun_dot_language__service__pb2.AnalyzeSyntaxRawRequest,
299
+ output=bareun_dot_language__service__pb2.AnalyzeSyntaxResponse,
300
+ idempotency_level=IdempotencyLevel.UNKNOWN,
301
+ ),
302
+ headers=headers,
303
+ timeout_ms=timeout_ms,
304
+ )
305
+
241
306
  def tokenize(
242
307
  self,
243
308
  request: bareun_dot_language__service__pb2.TokenizeRequest,
@@ -0,0 +1,76 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: bareun/language_service.proto
5
+ # Protobuf Python Version: 7.35.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 7,
15
+ 35,
16
+ 1,
17
+ '',
18
+ 'bareun/language_service.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+ from bareun import lang_common_pb2 as bareun_dot_lang__common__pb2
26
+
27
+
28
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1d\x62\x61reun/language_service.proto\x12\x06\x62\x61reun\x1a\x18\x62\x61reun/lang_common.proto\"q\n\x08Sentence\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12%\n\x06tokens\x18\x02 \x03(\x0b\x32\r.bareun.TokenR\x06tokens\x12\x18\n\x07refined\x18\x03 \x01(\tR\x07refined\"\x88\x01\n\x05Sense\x12\x19\n\x08sense_no\x18\x01 \x01(\rR\x07senseNo\x12\x18\n\x07meaning\x18\x02 \x01(\tR\x07meaning\x12(\n\x10urimal_target_id\x18\x03 \x01(\x05R\x0eurimalTargetId\x12 \n\x0bprobability\x18\x06 \x01(\x02R\x0bprobability\"\xfd\x06\n\x08Morpheme\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12&\n\x03tag\x18\x02 \x01(\x0e\x32\x14.bareun.Morpheme.TagR\x03tag\x12 \n\x0bprobability\x18\x03 \x01(\x02R\x0bprobability\x12=\n\x0cout_of_vocab\x18\x05 \x01(\x0e\x32\x1b.bareun.Morpheme.OutOfVocabR\noutOfVocab\x12-\n\x10\x63ustom_dict_name\x18\x06 \x01(\tH\x00R\x0e\x63ustomDictName\x88\x01\x01\x12(\n\x05sense\x18\x07 \x01(\x0b\x32\r.bareun.SenseH\x01R\x05sense\x88\x01\x01\"\x93\x01\n\nOutOfVocab\x12\x15\n\x11IN_WORD_EMBEDDING\x10\x00\x12\x10\n\x0cOUT_OF_VOCAB\x10\x01\x12\x12\n\x0eIN_CUSTOM_DICT\x10\x02\x12\x13\n\x0fIN_BUILTIN_DICT\x10\x03\x12\x11\n\rIN_URIMALSAEM\x10\x04\x12\x10\n\x0cIN_WIKI_DICT\x10\x05\x12\x0e\n\nIN_ON_DICT\x10\x06\"\x9d\x03\n\x03Tag\x12\x07\n\x03UNK\x10\x00\x12\x07\n\x03NNG\x10\x18\x12\x07\n\x03NNP\x10\x19\x12\x07\n\x03NNB\x10\x17\x12\x06\n\x02NP\x10\x1a\x12\x06\n\x02NR\x10\x1b\x12\x06\n\x02NF\x10\x16\x12\x06\n\x02NA\x10\x15\x12\x06\n\x02NV\x10\x1c\x12\x06\n\x02VV\x10)\x12\x06\n\x02VA\x10&\x12\x06\n\x02VX\x10*\x12\x07\n\x03VCP\x10(\x12\x07\n\x03VCN\x10\'\x12\x07\n\x03MMA\x10\x12\x12\x07\n\x03MMD\x10\x13\x12\x07\n\x03MMN\x10\x14\x12\x07\n\x03MAG\x10\x10\x12\x07\n\x03MAJ\x10\x11\x12\x06\n\x02IC\x10\x06\x12\x07\n\x03JKS\x10\r\x12\x07\n\x03JKC\x10\t\x12\x07\n\x03JKG\x10\n\x12\x07\n\x03JKO\x10\x0b\x12\x07\n\x03JKB\x10\x08\x12\x07\n\x03JKV\x10\x0e\x12\x07\n\x03JKQ\x10\x0c\x12\x06\n\x02JX\x10\x0f\x12\x06\n\x02JC\x10\x07\x12\x06\n\x02\x45P\x10\x03\x12\x06\n\x02\x45\x46\x10\x02\x12\x06\n\x02\x45\x43\x10\x01\x12\x07\n\x03\x45TN\x10\x05\x12\x07\n\x03\x45TM\x10\x04\x12\x07\n\x03XPN\x10+\x12\x07\n\x03XSN\x10.\x12\x07\n\x03XSV\x10/\x12\x07\n\x03XSA\x10-\x12\x06\n\x02XR\x10,\x12\x06\n\x02SF\x10\x1e\x12\x06\n\x02SP\x10#\x12\x06\n\x02SS\x10$\x12\x06\n\x02SE\x10\x1d\x12\x06\n\x02SO\x10\"\x12\x06\n\x02SW\x10%\x12\x06\n\x02SL\x10 \x12\x06\n\x02SH\x10\x1f\x12\x06\n\x02SN\x10!B\x13\n\x11_custom_dict_nameB\x08\n\x06_senseJ\x04\x08\x04\x10\x05R\x0e\x64isambiguation\"\xa7\x01\n\x05Token\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12.\n\tmorphemes\x18\x02 \x03(\x0b\x32\x10.bareun.MorphemeR\tmorphemes\x12\x14\n\x05lemma\x18\x04 \x01(\tR\x05lemma\x12\x16\n\x06tagged\x18\x05 \x01(\tR\x06tagged\x12\x1a\n\x08modified\x18\x0b \x01(\tR\x08modified\"\xeb\x02\n\x14\x41nalyzeSyntaxRequest\x12,\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\x10.bareun.DocumentR\x08\x64ocument\x12\x39\n\rencoding_type\x18\x02 \x01(\x0e\x32\x14.bareun.EncodingTypeR\x0c\x65ncodingType\x12.\n\x13\x61uto_split_sentence\x18\x03 \x01(\x08R\x11\x61utoSplitSentence\x12\'\n\rcustom_domain\x18\x04 \x01(\tB\x02\x18\x01R\x0c\x63ustomDomain\x12!\n\x0c\x61uto_spacing\x18\x05 \x01(\x08R\x0b\x61utoSpacing\x12#\n\rauto_jointing\x18\x06 \x01(\x08R\x0c\x61utoJointing\x12\x1d\n\nwith_sense\x18\x07 \x01(\x08R\twithSense\x12*\n\x11\x63ustom_dict_names\x18\x0b \x03(\tR\x0f\x63ustomDictNames\"\x86\x01\n\x15\x41nalyzeSyntaxResponse\x12.\n\tsentences\x18\x01 \x03(\x0b\x32\x10.bareun.SentenceR\tsentences\x12\x1a\n\x08language\x18\x03 \x01(\tR\x08language\x12!\n\x0ctokens_count\x18\x64 \x01(\x05R\x0btokensCount\"\xd1\x01\n\x17\x41nalyzeSyntaxRawRequest\x12,\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\x10.bareun.DocumentR\x08\x64ocument\x12\x39\n\rencoding_type\x18\x02 \x01(\x0e\x32\x14.bareun.EncodingTypeR\x0c\x65ncodingType\x12.\n\x13\x61uto_split_sentence\x18\x03 \x01(\x08R\x11\x61utoSplitSentence\x12\x1d\n\nwith_sense\x18\x04 \x01(\x08R\twithSense\"\xcb\x02\n\x18\x41nalyzeSyntaxListRequest\x12\x1c\n\tsentences\x18\x01 \x03(\tR\tsentences\x12\x1a\n\x08language\x18\x02 \x01(\tR\x08language\x12\x39\n\rencoding_type\x18\x03 \x01(\x0e\x32\x14.bareun.EncodingTypeR\x0c\x65ncodingType\x12\'\n\rcustom_domain\x18\x04 \x01(\tB\x02\x18\x01R\x0c\x63ustomDomain\x12!\n\x0c\x61uto_spacing\x18\x05 \x01(\x08R\x0b\x61utoSpacing\x12#\n\rauto_jointing\x18\x06 \x01(\x08R\x0c\x61utoJointing\x12\x1d\n\nwith_sense\x18\x07 \x01(\x08R\twithSense\x12*\n\x11\x63ustom_dict_names\x18\x0b \x03(\tR\x0f\x63ustomDictNames\"\x8a\x01\n\x19\x41nalyzeSyntaxListResponse\x12.\n\tsentences\x18\x01 \x03(\x0b\x32\x10.bareun.SentenceR\tsentences\x12\x1a\n\x08language\x18\x03 \x01(\tR\x08language\x12!\n\x0ctokens_count\x18\x64 \x01(\x05R\x0btokensCount\"\xd1\x01\n\x0fTokenizeRequest\x12,\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\x10.bareun.DocumentR\x08\x64ocument\x12\x39\n\rencoding_type\x18\x02 \x01(\x0e\x32\x14.bareun.EncodingTypeR\x0c\x65ncodingType\x12\x32\n\x13\x61uto_split_sentence\x18\x03 \x01(\x08\x42\x02\x18\x01R\x11\x61utoSplitSentence\x12!\n\x0c\x61uto_spacing\x18\x05 \x01(\x08R\x0b\x61utoSpacing\"C\n\x07Segment\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12\x12\n\x04hint\x18\x02 \x01(\tR\x04hint\"y\n\x0cSegmentToken\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12+\n\x08segments\x18\x02 \x03(\x0b\x32\x0f.bareun.SegmentR\x08segments\x12\x16\n\x06tagged\x18\x05 \x01(\tR\x06tagged\"e\n\x0fSegmentSentence\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12,\n\x06tokens\x18\x02 \x03(\x0b\x32\x14.bareun.SegmentTokenR\x06tokens\"\x88\x01\n\x10TokenizeResponse\x12\x35\n\tsentences\x18\x01 \x03(\x0b\x32\x17.bareun.SegmentSentenceR\tsentences\x12\x1a\n\x08language\x18\x03 \x01(\tR\x08language\x12!\n\x0ctokens_count\x18\x64 \x01(\x05R\x0btokensCount2\xd4\x02\n\x0fLanguageService\x12N\n\rAnalyzeSyntax\x12\x1c.bareun.AnalyzeSyntaxRequest\x1a\x1d.bareun.AnalyzeSyntaxResponse\"\x00\x12Z\n\x11\x41nalyzeSyntaxList\x12 .bareun.AnalyzeSyntaxListRequest\x1a!.bareun.AnalyzeSyntaxListResponse\"\x00\x12T\n\x10\x41nalyzeSyntaxRaw\x12\x1f.bareun.AnalyzeSyntaxRawRequest\x1a\x1d.bareun.AnalyzeSyntaxResponse\"\x00\x12?\n\x08Tokenize\x12\x17.bareun.TokenizeRequest\x1a\x18.bareun.TokenizeResponse\"\x00\x42U\n\x10\x61i.bareun.protosB\x14LanguageServiceProtoP\x01Z)bareun.ai/lang/bareun/genproto/bareun;svcb\x06proto3')
29
+
30
+ _globals = globals()
31
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
32
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'bareun.language_service_pb2', _globals)
33
+ if not _descriptor._USE_C_DESCRIPTORS:
34
+ _globals['DESCRIPTOR']._loaded_options = None
35
+ _globals['DESCRIPTOR']._serialized_options = b'\n\020ai.bareun.protosB\024LanguageServiceProtoP\001Z)bareun.ai/lang/bareun/genproto/bareun;svc'
36
+ _globals['_ANALYZESYNTAXREQUEST'].fields_by_name['custom_domain']._loaded_options = None
37
+ _globals['_ANALYZESYNTAXREQUEST'].fields_by_name['custom_domain']._serialized_options = b'\030\001'
38
+ _globals['_ANALYZESYNTAXLISTREQUEST'].fields_by_name['custom_domain']._loaded_options = None
39
+ _globals['_ANALYZESYNTAXLISTREQUEST'].fields_by_name['custom_domain']._serialized_options = b'\030\001'
40
+ _globals['_TOKENIZEREQUEST'].fields_by_name['auto_split_sentence']._loaded_options = None
41
+ _globals['_TOKENIZEREQUEST'].fields_by_name['auto_split_sentence']._serialized_options = b'\030\001'
42
+ _globals['_SENTENCE']._serialized_start=67
43
+ _globals['_SENTENCE']._serialized_end=180
44
+ _globals['_SENSE']._serialized_start=183
45
+ _globals['_SENSE']._serialized_end=319
46
+ _globals['_MORPHEME']._serialized_start=322
47
+ _globals['_MORPHEME']._serialized_end=1215
48
+ _globals['_MORPHEME_OUTOFVOCAB']._serialized_start=599
49
+ _globals['_MORPHEME_OUTOFVOCAB']._serialized_end=746
50
+ _globals['_MORPHEME_TAG']._serialized_start=749
51
+ _globals['_MORPHEME_TAG']._serialized_end=1162
52
+ _globals['_TOKEN']._serialized_start=1218
53
+ _globals['_TOKEN']._serialized_end=1385
54
+ _globals['_ANALYZESYNTAXREQUEST']._serialized_start=1388
55
+ _globals['_ANALYZESYNTAXREQUEST']._serialized_end=1751
56
+ _globals['_ANALYZESYNTAXRESPONSE']._serialized_start=1754
57
+ _globals['_ANALYZESYNTAXRESPONSE']._serialized_end=1888
58
+ _globals['_ANALYZESYNTAXRAWREQUEST']._serialized_start=1891
59
+ _globals['_ANALYZESYNTAXRAWREQUEST']._serialized_end=2100
60
+ _globals['_ANALYZESYNTAXLISTREQUEST']._serialized_start=2103
61
+ _globals['_ANALYZESYNTAXLISTREQUEST']._serialized_end=2434
62
+ _globals['_ANALYZESYNTAXLISTRESPONSE']._serialized_start=2437
63
+ _globals['_ANALYZESYNTAXLISTRESPONSE']._serialized_end=2575
64
+ _globals['_TOKENIZEREQUEST']._serialized_start=2578
65
+ _globals['_TOKENIZEREQUEST']._serialized_end=2787
66
+ _globals['_SEGMENT']._serialized_start=2789
67
+ _globals['_SEGMENT']._serialized_end=2856
68
+ _globals['_SEGMENTTOKEN']._serialized_start=2858
69
+ _globals['_SEGMENTTOKEN']._serialized_end=2979
70
+ _globals['_SEGMENTSENTENCE']._serialized_start=2981
71
+ _globals['_SEGMENTSENTENCE']._serialized_end=3082
72
+ _globals['_TOKENIZERESPONSE']._serialized_start=3085
73
+ _globals['_TOKENIZERESPONSE']._serialized_end=3221
74
+ _globals['_LANGUAGESERVICE']._serialized_start=3224
75
+ _globals['_LANGUAGESERVICE']._serialized_end=3564
76
+ # @@protoc_insertion_point(module_scope)
@@ -18,8 +18,20 @@ class Sentence(_message.Message):
18
18
  refined: str
19
19
  def __init__(self, text: _Optional[_Union[_lang_common_pb2.TextSpan, _Mapping]] = ..., tokens: _Optional[_Iterable[_Union[Token, _Mapping]]] = ..., refined: _Optional[str] = ...) -> None: ...
20
20
 
21
+ class Sense(_message.Message):
22
+ __slots__ = ("sense_no", "meaning", "urimal_target_id", "probability")
23
+ SENSE_NO_FIELD_NUMBER: _ClassVar[int]
24
+ MEANING_FIELD_NUMBER: _ClassVar[int]
25
+ URIMAL_TARGET_ID_FIELD_NUMBER: _ClassVar[int]
26
+ PROBABILITY_FIELD_NUMBER: _ClassVar[int]
27
+ sense_no: int
28
+ meaning: str
29
+ urimal_target_id: int
30
+ probability: float
31
+ def __init__(self, sense_no: _Optional[int] = ..., meaning: _Optional[str] = ..., urimal_target_id: _Optional[int] = ..., probability: _Optional[float] = ...) -> None: ...
32
+
21
33
  class Morpheme(_message.Message):
22
- __slots__ = ("text", "tag", "probability", "out_of_vocab", "custom_dict_name")
34
+ __slots__ = ("text", "tag", "probability", "out_of_vocab", "custom_dict_name", "sense")
23
35
  class OutOfVocab(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
24
36
  __slots__ = ()
25
37
  IN_WORD_EMBEDDING: _ClassVar[Morpheme.OutOfVocab]
@@ -139,12 +151,14 @@ class Morpheme(_message.Message):
139
151
  PROBABILITY_FIELD_NUMBER: _ClassVar[int]
140
152
  OUT_OF_VOCAB_FIELD_NUMBER: _ClassVar[int]
141
153
  CUSTOM_DICT_NAME_FIELD_NUMBER: _ClassVar[int]
154
+ SENSE_FIELD_NUMBER: _ClassVar[int]
142
155
  text: _lang_common_pb2.TextSpan
143
156
  tag: Morpheme.Tag
144
157
  probability: float
145
158
  out_of_vocab: Morpheme.OutOfVocab
146
159
  custom_dict_name: str
147
- def __init__(self, text: _Optional[_Union[_lang_common_pb2.TextSpan, _Mapping]] = ..., tag: _Optional[_Union[Morpheme.Tag, str]] = ..., probability: _Optional[float] = ..., out_of_vocab: _Optional[_Union[Morpheme.OutOfVocab, str]] = ..., custom_dict_name: _Optional[str] = ...) -> None: ...
160
+ sense: Sense
161
+ def __init__(self, text: _Optional[_Union[_lang_common_pb2.TextSpan, _Mapping]] = ..., tag: _Optional[_Union[Morpheme.Tag, str]] = ..., probability: _Optional[float] = ..., out_of_vocab: _Optional[_Union[Morpheme.OutOfVocab, str]] = ..., custom_dict_name: _Optional[str] = ..., sense: _Optional[_Union[Sense, _Mapping]] = ...) -> None: ...
148
162
 
149
163
  class Token(_message.Message):
150
164
  __slots__ = ("text", "morphemes", "lemma", "tagged", "modified")
@@ -161,13 +175,14 @@ class Token(_message.Message):
161
175
  def __init__(self, text: _Optional[_Union[_lang_common_pb2.TextSpan, _Mapping]] = ..., morphemes: _Optional[_Iterable[_Union[Morpheme, _Mapping]]] = ..., lemma: _Optional[str] = ..., tagged: _Optional[str] = ..., modified: _Optional[str] = ...) -> None: ...
162
176
 
163
177
  class AnalyzeSyntaxRequest(_message.Message):
164
- __slots__ = ("document", "encoding_type", "auto_split_sentence", "custom_domain", "auto_spacing", "auto_jointing", "custom_dict_names")
178
+ __slots__ = ("document", "encoding_type", "auto_split_sentence", "custom_domain", "auto_spacing", "auto_jointing", "with_sense", "custom_dict_names")
165
179
  DOCUMENT_FIELD_NUMBER: _ClassVar[int]
166
180
  ENCODING_TYPE_FIELD_NUMBER: _ClassVar[int]
167
181
  AUTO_SPLIT_SENTENCE_FIELD_NUMBER: _ClassVar[int]
168
182
  CUSTOM_DOMAIN_FIELD_NUMBER: _ClassVar[int]
169
183
  AUTO_SPACING_FIELD_NUMBER: _ClassVar[int]
170
184
  AUTO_JOINTING_FIELD_NUMBER: _ClassVar[int]
185
+ WITH_SENSE_FIELD_NUMBER: _ClassVar[int]
171
186
  CUSTOM_DICT_NAMES_FIELD_NUMBER: _ClassVar[int]
172
187
  document: _lang_common_pb2.Document
173
188
  encoding_type: _lang_common_pb2.EncodingType
@@ -175,8 +190,9 @@ class AnalyzeSyntaxRequest(_message.Message):
175
190
  custom_domain: str
176
191
  auto_spacing: bool
177
192
  auto_jointing: bool
193
+ with_sense: bool
178
194
  custom_dict_names: _containers.RepeatedScalarFieldContainer[str]
179
- def __init__(self, document: _Optional[_Union[_lang_common_pb2.Document, _Mapping]] = ..., encoding_type: _Optional[_Union[_lang_common_pb2.EncodingType, str]] = ..., auto_split_sentence: _Optional[bool] = ..., custom_domain: _Optional[str] = ..., auto_spacing: _Optional[bool] = ..., auto_jointing: _Optional[bool] = ..., custom_dict_names: _Optional[_Iterable[str]] = ...) -> None: ...
195
+ def __init__(self, document: _Optional[_Union[_lang_common_pb2.Document, _Mapping]] = ..., encoding_type: _Optional[_Union[_lang_common_pb2.EncodingType, str]] = ..., auto_split_sentence: _Optional[bool] = ..., custom_domain: _Optional[str] = ..., auto_spacing: _Optional[bool] = ..., auto_jointing: _Optional[bool] = ..., with_sense: _Optional[bool] = ..., custom_dict_names: _Optional[_Iterable[str]] = ...) -> None: ...
180
196
 
181
197
  class AnalyzeSyntaxResponse(_message.Message):
182
198
  __slots__ = ("sentences", "language", "tokens_count")
@@ -188,14 +204,27 @@ class AnalyzeSyntaxResponse(_message.Message):
188
204
  tokens_count: int
189
205
  def __init__(self, sentences: _Optional[_Iterable[_Union[Sentence, _Mapping]]] = ..., language: _Optional[str] = ..., tokens_count: _Optional[int] = ...) -> None: ...
190
206
 
207
+ class AnalyzeSyntaxRawRequest(_message.Message):
208
+ __slots__ = ("document", "encoding_type", "auto_split_sentence", "with_sense")
209
+ DOCUMENT_FIELD_NUMBER: _ClassVar[int]
210
+ ENCODING_TYPE_FIELD_NUMBER: _ClassVar[int]
211
+ AUTO_SPLIT_SENTENCE_FIELD_NUMBER: _ClassVar[int]
212
+ WITH_SENSE_FIELD_NUMBER: _ClassVar[int]
213
+ document: _lang_common_pb2.Document
214
+ encoding_type: _lang_common_pb2.EncodingType
215
+ auto_split_sentence: bool
216
+ with_sense: bool
217
+ def __init__(self, document: _Optional[_Union[_lang_common_pb2.Document, _Mapping]] = ..., encoding_type: _Optional[_Union[_lang_common_pb2.EncodingType, str]] = ..., auto_split_sentence: _Optional[bool] = ..., with_sense: _Optional[bool] = ...) -> None: ...
218
+
191
219
  class AnalyzeSyntaxListRequest(_message.Message):
192
- __slots__ = ("sentences", "language", "encoding_type", "custom_domain", "auto_spacing", "auto_jointing", "custom_dict_names")
220
+ __slots__ = ("sentences", "language", "encoding_type", "custom_domain", "auto_spacing", "auto_jointing", "with_sense", "custom_dict_names")
193
221
  SENTENCES_FIELD_NUMBER: _ClassVar[int]
194
222
  LANGUAGE_FIELD_NUMBER: _ClassVar[int]
195
223
  ENCODING_TYPE_FIELD_NUMBER: _ClassVar[int]
196
224
  CUSTOM_DOMAIN_FIELD_NUMBER: _ClassVar[int]
197
225
  AUTO_SPACING_FIELD_NUMBER: _ClassVar[int]
198
226
  AUTO_JOINTING_FIELD_NUMBER: _ClassVar[int]
227
+ WITH_SENSE_FIELD_NUMBER: _ClassVar[int]
199
228
  CUSTOM_DICT_NAMES_FIELD_NUMBER: _ClassVar[int]
200
229
  sentences: _containers.RepeatedScalarFieldContainer[str]
201
230
  language: str
@@ -203,8 +232,9 @@ class AnalyzeSyntaxListRequest(_message.Message):
203
232
  custom_domain: str
204
233
  auto_spacing: bool
205
234
  auto_jointing: bool
235
+ with_sense: bool
206
236
  custom_dict_names: _containers.RepeatedScalarFieldContainer[str]
207
- def __init__(self, sentences: _Optional[_Iterable[str]] = ..., language: _Optional[str] = ..., encoding_type: _Optional[_Union[_lang_common_pb2.EncodingType, str]] = ..., custom_domain: _Optional[str] = ..., auto_spacing: _Optional[bool] = ..., auto_jointing: _Optional[bool] = ..., custom_dict_names: _Optional[_Iterable[str]] = ...) -> None: ...
237
+ def __init__(self, sentences: _Optional[_Iterable[str]] = ..., language: _Optional[str] = ..., encoding_type: _Optional[_Union[_lang_common_pb2.EncodingType, str]] = ..., custom_domain: _Optional[str] = ..., auto_spacing: _Optional[bool] = ..., auto_jointing: _Optional[bool] = ..., with_sense: _Optional[bool] = ..., custom_dict_names: _Optional[_Iterable[str]] = ...) -> None: ...
208
238
 
209
239
  class AnalyzeSyntaxListResponse(_message.Message):
210
240
  __slots__ = ("sentences", "language", "tokens_count")
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "bareunpy"
3
- version = "2.0.0"
3
+ version = "2.1.0"
4
4
  description = "The bareun python library using connect-rpc"
5
5
  authors = ["Gihyun YUN <gih2yun@baikal.ai>"]
6
6
  license = "BSD-3-Clause"
@@ -1,4 +0,0 @@
1
-
2
- version = "2.0.0"
3
- bareun_version = "3.0.0"
4
-
@@ -1,72 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Generated by the protocol buffer compiler. DO NOT EDIT!
3
- # NO CHECKED-IN PROTOBUF GENCODE
4
- # source: bareun/language_service.proto
5
- # Protobuf Python Version: 7.35.1
6
- """Generated protocol buffer code."""
7
- from google.protobuf import descriptor as _descriptor
8
- from google.protobuf import descriptor_pool as _descriptor_pool
9
- from google.protobuf import runtime_version as _runtime_version
10
- from google.protobuf import symbol_database as _symbol_database
11
- from google.protobuf.internal import builder as _builder
12
- _runtime_version.ValidateProtobufRuntimeVersion(
13
- _runtime_version.Domain.PUBLIC,
14
- 7,
15
- 35,
16
- 1,
17
- '',
18
- 'bareun/language_service.proto'
19
- )
20
- # @@protoc_insertion_point(imports)
21
-
22
- _sym_db = _symbol_database.Default()
23
-
24
-
25
- from bareun import lang_common_pb2 as bareun_dot_lang__common__pb2
26
-
27
-
28
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1d\x62\x61reun/language_service.proto\x12\x06\x62\x61reun\x1a\x18\x62\x61reun/lang_common.proto\"q\n\x08Sentence\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12%\n\x06tokens\x18\x02 \x03(\x0b\x32\r.bareun.TokenR\x06tokens\x12\x18\n\x07refined\x18\x03 \x01(\tR\x07refined\"\xb3\x06\n\x08Morpheme\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12&\n\x03tag\x18\x02 \x01(\x0e\x32\x14.bareun.Morpheme.TagR\x03tag\x12 \n\x0bprobability\x18\x03 \x01(\x02R\x0bprobability\x12=\n\x0cout_of_vocab\x18\x05 \x01(\x0e\x32\x1b.bareun.Morpheme.OutOfVocabR\noutOfVocab\x12-\n\x10\x63ustom_dict_name\x18\x06 \x01(\tH\x00R\x0e\x63ustomDictName\x88\x01\x01\"\x93\x01\n\nOutOfVocab\x12\x15\n\x11IN_WORD_EMBEDDING\x10\x00\x12\x10\n\x0cOUT_OF_VOCAB\x10\x01\x12\x12\n\x0eIN_CUSTOM_DICT\x10\x02\x12\x13\n\x0fIN_BUILTIN_DICT\x10\x03\x12\x11\n\rIN_URIMALSAEM\x10\x04\x12\x10\n\x0cIN_WIKI_DICT\x10\x05\x12\x0e\n\nIN_ON_DICT\x10\x06\"\x9d\x03\n\x03Tag\x12\x07\n\x03UNK\x10\x00\x12\x07\n\x03NNG\x10\x18\x12\x07\n\x03NNP\x10\x19\x12\x07\n\x03NNB\x10\x17\x12\x06\n\x02NP\x10\x1a\x12\x06\n\x02NR\x10\x1b\x12\x06\n\x02NF\x10\x16\x12\x06\n\x02NA\x10\x15\x12\x06\n\x02NV\x10\x1c\x12\x06\n\x02VV\x10)\x12\x06\n\x02VA\x10&\x12\x06\n\x02VX\x10*\x12\x07\n\x03VCP\x10(\x12\x07\n\x03VCN\x10\'\x12\x07\n\x03MMA\x10\x12\x12\x07\n\x03MMD\x10\x13\x12\x07\n\x03MMN\x10\x14\x12\x07\n\x03MAG\x10\x10\x12\x07\n\x03MAJ\x10\x11\x12\x06\n\x02IC\x10\x06\x12\x07\n\x03JKS\x10\r\x12\x07\n\x03JKC\x10\t\x12\x07\n\x03JKG\x10\n\x12\x07\n\x03JKO\x10\x0b\x12\x07\n\x03JKB\x10\x08\x12\x07\n\x03JKV\x10\x0e\x12\x07\n\x03JKQ\x10\x0c\x12\x06\n\x02JX\x10\x0f\x12\x06\n\x02JC\x10\x07\x12\x06\n\x02\x45P\x10\x03\x12\x06\n\x02\x45\x46\x10\x02\x12\x06\n\x02\x45\x43\x10\x01\x12\x07\n\x03\x45TN\x10\x05\x12\x07\n\x03\x45TM\x10\x04\x12\x07\n\x03XPN\x10+\x12\x07\n\x03XSN\x10.\x12\x07\n\x03XSV\x10/\x12\x07\n\x03XSA\x10-\x12\x06\n\x02XR\x10,\x12\x06\n\x02SF\x10\x1e\x12\x06\n\x02SP\x10#\x12\x06\n\x02SS\x10$\x12\x06\n\x02SE\x10\x1d\x12\x06\n\x02SO\x10\"\x12\x06\n\x02SW\x10%\x12\x06\n\x02SL\x10 \x12\x06\n\x02SH\x10\x1f\x12\x06\n\x02SN\x10!B\x13\n\x11_custom_dict_name\"\xa7\x01\n\x05Token\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12.\n\tmorphemes\x18\x02 \x03(\x0b\x32\x10.bareun.MorphemeR\tmorphemes\x12\x14\n\x05lemma\x18\x04 \x01(\tR\x05lemma\x12\x16\n\x06tagged\x18\x05 \x01(\tR\x06tagged\x12\x1a\n\x08modified\x18\x0b \x01(\tR\x08modified\"\xcc\x02\n\x14\x41nalyzeSyntaxRequest\x12,\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\x10.bareun.DocumentR\x08\x64ocument\x12\x39\n\rencoding_type\x18\x02 \x01(\x0e\x32\x14.bareun.EncodingTypeR\x0c\x65ncodingType\x12.\n\x13\x61uto_split_sentence\x18\x03 \x01(\x08R\x11\x61utoSplitSentence\x12\'\n\rcustom_domain\x18\x04 \x01(\tB\x02\x18\x01R\x0c\x63ustomDomain\x12!\n\x0c\x61uto_spacing\x18\x05 \x01(\x08R\x0b\x61utoSpacing\x12#\n\rauto_jointing\x18\x06 \x01(\x08R\x0c\x61utoJointing\x12*\n\x11\x63ustom_dict_names\x18\x0b \x03(\tR\x0f\x63ustomDictNames\"\x86\x01\n\x15\x41nalyzeSyntaxResponse\x12.\n\tsentences\x18\x01 \x03(\x0b\x32\x10.bareun.SentenceR\tsentences\x12\x1a\n\x08language\x18\x03 \x01(\tR\x08language\x12!\n\x0ctokens_count\x18\x64 \x01(\x05R\x0btokensCount\"\xac\x02\n\x18\x41nalyzeSyntaxListRequest\x12\x1c\n\tsentences\x18\x01 \x03(\tR\tsentences\x12\x1a\n\x08language\x18\x02 \x01(\tR\x08language\x12\x39\n\rencoding_type\x18\x03 \x01(\x0e\x32\x14.bareun.EncodingTypeR\x0c\x65ncodingType\x12\'\n\rcustom_domain\x18\x04 \x01(\tB\x02\x18\x01R\x0c\x63ustomDomain\x12!\n\x0c\x61uto_spacing\x18\x05 \x01(\x08R\x0b\x61utoSpacing\x12#\n\rauto_jointing\x18\x06 \x01(\x08R\x0c\x61utoJointing\x12*\n\x11\x63ustom_dict_names\x18\x0b \x03(\tR\x0f\x63ustomDictNames\"\x8a\x01\n\x19\x41nalyzeSyntaxListResponse\x12.\n\tsentences\x18\x01 \x03(\x0b\x32\x10.bareun.SentenceR\tsentences\x12\x1a\n\x08language\x18\x03 \x01(\tR\x08language\x12!\n\x0ctokens_count\x18\x64 \x01(\x05R\x0btokensCount\"\xd1\x01\n\x0fTokenizeRequest\x12,\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\x10.bareun.DocumentR\x08\x64ocument\x12\x39\n\rencoding_type\x18\x02 \x01(\x0e\x32\x14.bareun.EncodingTypeR\x0c\x65ncodingType\x12\x32\n\x13\x61uto_split_sentence\x18\x03 \x01(\x08\x42\x02\x18\x01R\x11\x61utoSplitSentence\x12!\n\x0c\x61uto_spacing\x18\x05 \x01(\x08R\x0b\x61utoSpacing\"C\n\x07Segment\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12\x12\n\x04hint\x18\x02 \x01(\tR\x04hint\"y\n\x0cSegmentToken\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12+\n\x08segments\x18\x02 \x03(\x0b\x32\x0f.bareun.SegmentR\x08segments\x12\x16\n\x06tagged\x18\x05 \x01(\tR\x06tagged\"e\n\x0fSegmentSentence\x12$\n\x04text\x18\x01 \x01(\x0b\x32\x10.bareun.TextSpanR\x04text\x12,\n\x06tokens\x18\x02 \x03(\x0b\x32\x14.bareun.SegmentTokenR\x06tokens\"\x88\x01\n\x10TokenizeResponse\x12\x35\n\tsentences\x18\x01 \x03(\x0b\x32\x17.bareun.SegmentSentenceR\tsentences\x12\x1a\n\x08language\x18\x03 \x01(\tR\x08language\x12!\n\x0ctokens_count\x18\x64 \x01(\x05R\x0btokensCount2\xfe\x01\n\x0fLanguageService\x12N\n\rAnalyzeSyntax\x12\x1c.bareun.AnalyzeSyntaxRequest\x1a\x1d.bareun.AnalyzeSyntaxResponse\"\x00\x12Z\n\x11\x41nalyzeSyntaxList\x12 .bareun.AnalyzeSyntaxListRequest\x1a!.bareun.AnalyzeSyntaxListResponse\"\x00\x12?\n\x08Tokenize\x12\x17.bareun.TokenizeRequest\x1a\x18.bareun.TokenizeResponse\"\x00\x42U\n\x10\x61i.bareun.protosB\x14LanguageServiceProtoP\x01Z)bareun.ai/lang/bareun/genproto/bareun;svcb\x06proto3')
29
-
30
- _globals = globals()
31
- _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
32
- _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'bareun.language_service_pb2', _globals)
33
- if not _descriptor._USE_C_DESCRIPTORS:
34
- _globals['DESCRIPTOR']._loaded_options = None
35
- _globals['DESCRIPTOR']._serialized_options = b'\n\020ai.bareun.protosB\024LanguageServiceProtoP\001Z)bareun.ai/lang/bareun/genproto/bareun;svc'
36
- _globals['_ANALYZESYNTAXREQUEST'].fields_by_name['custom_domain']._loaded_options = None
37
- _globals['_ANALYZESYNTAXREQUEST'].fields_by_name['custom_domain']._serialized_options = b'\030\001'
38
- _globals['_ANALYZESYNTAXLISTREQUEST'].fields_by_name['custom_domain']._loaded_options = None
39
- _globals['_ANALYZESYNTAXLISTREQUEST'].fields_by_name['custom_domain']._serialized_options = b'\030\001'
40
- _globals['_TOKENIZEREQUEST'].fields_by_name['auto_split_sentence']._loaded_options = None
41
- _globals['_TOKENIZEREQUEST'].fields_by_name['auto_split_sentence']._serialized_options = b'\030\001'
42
- _globals['_SENTENCE']._serialized_start=67
43
- _globals['_SENTENCE']._serialized_end=180
44
- _globals['_MORPHEME']._serialized_start=183
45
- _globals['_MORPHEME']._serialized_end=1002
46
- _globals['_MORPHEME_OUTOFVOCAB']._serialized_start=418
47
- _globals['_MORPHEME_OUTOFVOCAB']._serialized_end=565
48
- _globals['_MORPHEME_TAG']._serialized_start=568
49
- _globals['_MORPHEME_TAG']._serialized_end=981
50
- _globals['_TOKEN']._serialized_start=1005
51
- _globals['_TOKEN']._serialized_end=1172
52
- _globals['_ANALYZESYNTAXREQUEST']._serialized_start=1175
53
- _globals['_ANALYZESYNTAXREQUEST']._serialized_end=1507
54
- _globals['_ANALYZESYNTAXRESPONSE']._serialized_start=1510
55
- _globals['_ANALYZESYNTAXRESPONSE']._serialized_end=1644
56
- _globals['_ANALYZESYNTAXLISTREQUEST']._serialized_start=1647
57
- _globals['_ANALYZESYNTAXLISTREQUEST']._serialized_end=1947
58
- _globals['_ANALYZESYNTAXLISTRESPONSE']._serialized_start=1950
59
- _globals['_ANALYZESYNTAXLISTRESPONSE']._serialized_end=2088
60
- _globals['_TOKENIZEREQUEST']._serialized_start=2091
61
- _globals['_TOKENIZEREQUEST']._serialized_end=2300
62
- _globals['_SEGMENT']._serialized_start=2302
63
- _globals['_SEGMENT']._serialized_end=2369
64
- _globals['_SEGMENTTOKEN']._serialized_start=2371
65
- _globals['_SEGMENTTOKEN']._serialized_end=2492
66
- _globals['_SEGMENTSENTENCE']._serialized_start=2494
67
- _globals['_SEGMENTSENTENCE']._serialized_end=2595
68
- _globals['_TOKENIZERESPONSE']._serialized_start=2598
69
- _globals['_TOKENIZERESPONSE']._serialized_end=2734
70
- _globals['_LANGUAGESERVICE']._serialized_start=2737
71
- _globals['_LANGUAGESERVICE']._serialized_end=2991
72
- # @@protoc_insertion_point(module_scope)
File without changes
File without changes