bareunpy 2.0.1__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.
- {bareunpy-2.0.1 → bareunpy-2.1.0}/PKG-INFO +55 -1
- {bareunpy-2.0.1 → bareunpy-2.1.0}/README.md +54 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/__init__.py +4 -1
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/_lang_service_client.py +17 -3
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/_tagger.py +154 -22
- bareunpy-2.1.0/bareunpy/_version.py +4 -0
- bareunpy-2.1.0/bareunpy/bareun/language_service_pb2.py +76 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/language_service_pb2.pyi +28 -8
- {bareunpy-2.0.1 → bareunpy-2.1.0}/pyproject.toml +1 -1
- bareunpy-2.0.1/bareunpy/_version.py +0 -4
- bareunpy-2.0.1/bareunpy/bareun/language_service_pb2.py +0 -74
- {bareunpy-2.0.1 → bareunpy-2.1.0}/LICENSE +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/_corrector.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/_custom_dict.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/_custom_dict_client.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/_revision_service_client.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/_tokenizer.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/__init__.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/custom_dict_connect.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/custom_dict_pb2.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/custom_dict_pb2.pyi +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/dict_common_pb2.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/dict_common_pb2.pyi +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/lang_common_pb2.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/lang_common_pb2.pyi +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/language_service_connect.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/py.typed +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/revision_service_connect.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/revision_service_pb2.py +0 -0
- {bareunpy-2.0.1 → bareunpy-2.1.0}/bareunpy/bareun/revision_service_pb2.pyi +0 -0
- {bareunpy-2.0.1 → 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
|
|
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
|
|
@@ -48,6 +48,15 @@ Description-Content-Type: text/markdown
|
|
|
48
48
|
|
|
49
49
|
## 변경사항
|
|
50
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
|
+
|
|
51
60
|
### 2.0.1
|
|
52
61
|
|
|
53
62
|
- **AnalyzeSyntaxRaw API 추가**: `tagger.tag_raw()` — seg+tag 모델 추론만 수행, 복합명사·동사 분해/사용자 사전/자동 띄어쓰기 후처리 없이 순수 모델 출력 반환
|
|
@@ -159,6 +168,50 @@ print(res.pos())
|
|
|
159
168
|
res = tagger.tag_raw('나는밥을먹었다. 그리고잤다.', auto_split=True)
|
|
160
169
|
```
|
|
161
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
|
+
|
|
162
215
|
### 분석 옵션
|
|
163
216
|
|
|
164
217
|
`tag()`, `tags()`, `taglist()` 메서드에서 다음 옵션을 사용할 수 있습니다.
|
|
@@ -168,6 +221,7 @@ res = tagger.tag_raw('나는밥을먹었다. 그리고잤다.', auto_split=True)
|
|
|
168
221
|
| `auto_split` | bool | `False` | 문장 자동 분리 (`tag`, `tags`만 해당) |
|
|
169
222
|
| `auto_spacing` | bool | `True` | 띄어쓰기 보정 |
|
|
170
223
|
| `auto_jointing` | bool | `True` | 붙여쓰기 보정 |
|
|
224
|
+
| `with_sense` | bool | `False` | 동형이의어 의미 구분(WSD, 베타) 결과 포함 — `tag_raw()` 에서도 사용 가능 |
|
|
171
225
|
|
|
172
226
|
```python
|
|
173
227
|
res = tagger.tag('햇빛이선명하게나뭇잎을핥고있었다', auto_spacing=True, auto_jointing=True)
|
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
|
|
9
9
|
## 변경사항
|
|
10
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
|
+
|
|
11
20
|
### 2.0.1
|
|
12
21
|
|
|
13
22
|
- **AnalyzeSyntaxRaw API 추가**: `tagger.tag_raw()` — seg+tag 모델 추론만 수행, 복합명사·동사 분해/사용자 사전/자동 띄어쓰기 후처리 없이 순수 모델 출력 반환
|
|
@@ -119,6 +128,50 @@ print(res.pos())
|
|
|
119
128
|
res = tagger.tag_raw('나는밥을먹었다. 그리고잤다.', auto_split=True)
|
|
120
129
|
```
|
|
121
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
|
+
|
|
122
175
|
### 분석 옵션
|
|
123
176
|
|
|
124
177
|
`tag()`, `tags()`, `taglist()` 메서드에서 다음 옵션을 사용할 수 있습니다.
|
|
@@ -128,6 +181,7 @@ res = tagger.tag_raw('나는밥을먹었다. 그리고잤다.', auto_split=True)
|
|
|
128
181
|
| `auto_split` | bool | `False` | 문장 자동 분리 (`tag`, `tags`만 해당) |
|
|
129
182
|
| `auto_spacing` | bool | `True` | 띄어쓰기 보정 |
|
|
130
183
|
| `auto_jointing` | bool | `True` | 붙여쓰기 보정 |
|
|
184
|
+
| `with_sense` | bool | `False` | 동형이의어 의미 구분(WSD, 베타) 결과 포함 — `tag_raw()` 에서도 사용 가능 |
|
|
131
185
|
|
|
132
186
|
```python
|
|
133
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
|
|
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
|
|
|
@@ -172,7 +178,8 @@ class BareunLanguageServiceClient:
|
|
|
172
178
|
self._handle_connect_error(e)
|
|
173
179
|
|
|
174
180
|
def analyze_syntax_raw(self, content: str,
|
|
175
|
-
auto_split: bool = False
|
|
181
|
+
auto_split: bool = False,
|
|
182
|
+
with_sense: bool = False) -> pb.AnalyzeSyntaxResponse:
|
|
176
183
|
"""모델 추론만 수행하는 원시(raw) 형태소 분석을 수행합니다.
|
|
177
184
|
|
|
178
185
|
복합명사·동사 분해, 자동 띄어쓰기·붙여쓰기 보정, 사용자 사전을 일절 적용하지 않습니다.
|
|
@@ -182,6 +189,8 @@ class BareunLanguageServiceClient:
|
|
|
182
189
|
Args:
|
|
183
190
|
content (str): 형태소 분석할 원문. 여러 문장은 개행문자로 구분합니다.
|
|
184
191
|
auto_split (bool): 문장 자동 분리 여부. 기본값은 False(개행 기준으로 분리).
|
|
192
|
+
with_sense (bool): 동형이의어 의미 구분(WSD, 베타) 결과를 함께 받을지 여부.
|
|
193
|
+
기본값 False. 의미도 후처리 없이 모델 출력 그대로 실립니다.
|
|
185
194
|
|
|
186
195
|
Raises:
|
|
187
196
|
Exception: 원격 호출시 예외가 발생할 수 있습니다.
|
|
@@ -194,6 +203,7 @@ class BareunLanguageServiceClient:
|
|
|
194
203
|
req.document.language = "ko_KR"
|
|
195
204
|
req.encoding_type = lpb.EncodingType.UTF32
|
|
196
205
|
req.auto_split_sentence = auto_split
|
|
206
|
+
req.with_sense = with_sense
|
|
197
207
|
|
|
198
208
|
try:
|
|
199
209
|
return self.stub.analyze_syntax_raw(req, headers=self.metadata)
|
|
@@ -203,7 +213,8 @@ class BareunLanguageServiceClient:
|
|
|
203
213
|
def analyze_syntax_list(self, content: List[str],
|
|
204
214
|
custom_dicts: Optional[List[str]] = None,
|
|
205
215
|
auto_spacing: bool = True,
|
|
206
|
-
auto_jointing: bool = True
|
|
216
|
+
auto_jointing: bool = True,
|
|
217
|
+
with_sense: bool = False) -> pb.AnalyzeSyntaxListResponse:
|
|
207
218
|
"""형태소 분석을 수행하되, 입력된 문장 단위가 일치하도록 반환됩니다.
|
|
208
219
|
|
|
209
220
|
문장 분할 기능을 사용하지 않습니다.
|
|
@@ -213,6 +224,8 @@ class BareunLanguageServiceClient:
|
|
|
213
224
|
custom_dicts (Optional[List[str]]): 사용자 사전의 이름 목록. 기본값은 None(사용 안 함).
|
|
214
225
|
auto_spacing (bool): 띄어쓰기 보정 기능, 기본값은 사용하도록 함.
|
|
215
226
|
auto_jointing (bool): 붙여쓰기 보정 기능, 기본값은 사용하도록 함.
|
|
227
|
+
with_sense (bool): 동형이의어 의미 구분(WSD, 베타) 결과를 함께 받을지 여부.
|
|
228
|
+
기본값 False.
|
|
216
229
|
|
|
217
230
|
Raises:
|
|
218
231
|
Exception: 원격 호출시 예외가 발생할 수 있습니다.
|
|
@@ -226,6 +239,7 @@ class BareunLanguageServiceClient:
|
|
|
226
239
|
req.encoding_type = lpb.EncodingType.UTF32
|
|
227
240
|
req.auto_spacing = auto_spacing
|
|
228
241
|
req.auto_jointing = auto_jointing
|
|
242
|
+
req.with_sense = with_sense
|
|
229
243
|
if custom_dicts:
|
|
230
244
|
req.custom_dict_names.extend(custom_dicts)
|
|
231
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
|
|
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'{
|
|
142
|
+
return f'{content}/{Morpheme.Tag.Name(m.tag)}{p}{oov}'
|
|
94
143
|
else:
|
|
95
|
-
return f'{
|
|
144
|
+
return f'{content}/{Morpheme.Tag.Name(m.tag)}'
|
|
96
145
|
else:
|
|
97
146
|
if detail:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
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
|
|
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,7 +302,7 @@ 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_raw(self, phrase: str, auto_split: bool = False) -> Tagged:
|
|
305
|
+
def tag_raw(self, phrase: str, auto_split: bool = False, with_sense: bool = False) -> Tagged:
|
|
218
306
|
"""모델 추론만 수행하는 원시(raw) 형태소 분석을 수행합니다.
|
|
219
307
|
|
|
220
308
|
복합명사·동사 분해, 자동 띄어쓰기·붙여쓰기 보정, 사용자 사전을 일절 적용하지 않습니다.
|
|
@@ -222,61 +310,105 @@ class Tagger:
|
|
|
222
310
|
|
|
223
311
|
:param phrase: 분석할 문자열
|
|
224
312
|
:param auto_split: 문장 자동 분리 여부 (기본값: False)
|
|
313
|
+
:param with_sense: 동형이의어 의미 구분(WSD, 베타) 결과를 함께 받을지 여부 (기본값: False)
|
|
225
314
|
:return: Tagged result instance
|
|
226
315
|
"""
|
|
227
316
|
if len(phrase) == 0:
|
|
228
317
|
print("OOPS, no sentences.")
|
|
229
318
|
return Tagged('', AnalyzeSyntaxResponse())
|
|
230
|
-
res = self.client.analyze_syntax_raw(phrase, auto_split=auto_split)
|
|
319
|
+
res = self.client.analyze_syntax_raw(phrase, auto_split=auto_split, with_sense=with_sense)
|
|
231
320
|
return Tagged(phrase, res)
|
|
232
321
|
|
|
233
|
-
def tag(self, phrase: str, auto_split: bool = False, auto_spacing: bool = True,
|
|
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
|
+
"""
|
|
234
334
|
if len(phrase) == 0:
|
|
235
335
|
print("OOPS, no sentences.")
|
|
236
336
|
return Tagged('', AnalyzeSyntaxResponse())
|
|
237
337
|
# 에러 변환은 BareunLanguageServiceClient 내부에서 처리하므로 여기서 직접 호출한다.
|
|
238
|
-
res = self.client.analyze_syntax(phrase, self.custom_dicts, auto_split=auto_split,
|
|
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)
|
|
239
341
|
return Tagged(phrase, res)
|
|
240
342
|
|
|
241
|
-
def tags(self, phrase: List[str], auto_split: bool = False, auto_spacing: bool = True,
|
|
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:
|
|
242
345
|
"""
|
|
243
346
|
tag string array.
|
|
244
347
|
:param phrase: array of string
|
|
245
348
|
:param auto_split(bool, optional): Whether to automatically perform sentence split
|
|
246
349
|
:param auto_spacing(bool, optional): Whether to automatically perform space insertion for typo correction
|
|
247
350
|
:param auto_jointing(bool, optional): Whether to automatically perform word joining for typo correction
|
|
351
|
+
:param with_sense(bool, optional): 동형이의어 의미 구분(WSD, 베타) 결과 포함 여부
|
|
248
352
|
:return: Tagged result instance
|
|
249
353
|
"""
|
|
250
354
|
if len(phrase) == 0:
|
|
251
355
|
print("OOPS, no sentences.")
|
|
252
356
|
return Tagged('', AnalyzeSyntaxResponse())
|
|
253
357
|
p = '\n'.join(phrase)
|
|
254
|
-
res = self.client.analyze_syntax(p, self.custom_dicts, auto_split=auto_split,
|
|
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)
|
|
255
361
|
return Tagged(p, res)
|
|
256
362
|
|
|
257
|
-
def taglist(self, phrase: List[str], auto_spacing: bool = True, auto_jointing: bool = True
|
|
363
|
+
def taglist(self, phrase: List[str], auto_spacing: bool = True, auto_jointing: bool = True,
|
|
364
|
+
with_sense: bool = False) -> Tagged:
|
|
258
365
|
"""
|
|
259
366
|
문장 분할 없이 입력된 문장 단위 그대로 형태소 분석을 수행합니다.
|
|
260
367
|
:param phrase: 분석할 문장의 리스트
|
|
261
368
|
:param auto_spacing(bool, optional): 띄어쓰기 보정 기능 (기본값: True)
|
|
262
369
|
:param auto_jointing(bool, optional): 붙여쓰기 보정 기능 (기본값: True)
|
|
370
|
+
:param with_sense(bool, optional): 동형이의어 의미 구분(WSD, 베타) 결과 포함 여부
|
|
263
371
|
:return: Tagged result instance
|
|
264
372
|
"""
|
|
265
373
|
if len(phrase) == 0:
|
|
266
374
|
print("OOPS, no sentences.")
|
|
267
375
|
return Tagged('', AnalyzeSyntaxListResponse())
|
|
268
|
-
res = self.client.analyze_syntax_list(phrase, self.custom_dicts, auto_spacing=auto_spacing,
|
|
376
|
+
res = self.client.analyze_syntax_list(phrase, self.custom_dicts, auto_spacing=auto_spacing,
|
|
377
|
+
auto_jointing=auto_jointing, with_sense=with_sense)
|
|
269
378
|
return Tagged(phrase, res)
|
|
270
379
|
|
|
271
|
-
def pos(self, phrase: str, flatten: bool = True, join: bool = False, detail: bool = False
|
|
380
|
+
def pos(self, phrase: str, flatten: bool = True, join: bool = False, detail: bool = False,
|
|
381
|
+
sense: bool = False) -> List:
|
|
272
382
|
"""
|
|
273
383
|
POS tagger.
|
|
274
384
|
:param phrase : string to analyse
|
|
275
385
|
:param flatten : If False, returns original morphs.
|
|
276
386
|
:param join : If True, returns joined sets of morph and tag.
|
|
277
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` 의 목록
|
|
278
410
|
"""
|
|
279
|
-
return self.tag(phrase
|
|
411
|
+
return self.tag(phrase, auto_split=auto_split, with_sense=True).senses()
|
|
280
412
|
|
|
281
413
|
def morphs(self, phrase: str) -> List:
|
|
282
414
|
"""Parse phrase to morphemes."""
|
|
@@ -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
|
-
|
|
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")
|
|
@@ -189,23 +205,26 @@ class AnalyzeSyntaxResponse(_message.Message):
|
|
|
189
205
|
def __init__(self, sentences: _Optional[_Iterable[_Union[Sentence, _Mapping]]] = ..., language: _Optional[str] = ..., tokens_count: _Optional[int] = ...) -> None: ...
|
|
190
206
|
|
|
191
207
|
class AnalyzeSyntaxRawRequest(_message.Message):
|
|
192
|
-
__slots__ = ("document", "encoding_type", "auto_split_sentence")
|
|
208
|
+
__slots__ = ("document", "encoding_type", "auto_split_sentence", "with_sense")
|
|
193
209
|
DOCUMENT_FIELD_NUMBER: _ClassVar[int]
|
|
194
210
|
ENCODING_TYPE_FIELD_NUMBER: _ClassVar[int]
|
|
195
211
|
AUTO_SPLIT_SENTENCE_FIELD_NUMBER: _ClassVar[int]
|
|
212
|
+
WITH_SENSE_FIELD_NUMBER: _ClassVar[int]
|
|
196
213
|
document: _lang_common_pb2.Document
|
|
197
214
|
encoding_type: _lang_common_pb2.EncodingType
|
|
198
215
|
auto_split_sentence: bool
|
|
199
|
-
|
|
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: ...
|
|
200
218
|
|
|
201
219
|
class AnalyzeSyntaxListRequest(_message.Message):
|
|
202
|
-
__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")
|
|
203
221
|
SENTENCES_FIELD_NUMBER: _ClassVar[int]
|
|
204
222
|
LANGUAGE_FIELD_NUMBER: _ClassVar[int]
|
|
205
223
|
ENCODING_TYPE_FIELD_NUMBER: _ClassVar[int]
|
|
206
224
|
CUSTOM_DOMAIN_FIELD_NUMBER: _ClassVar[int]
|
|
207
225
|
AUTO_SPACING_FIELD_NUMBER: _ClassVar[int]
|
|
208
226
|
AUTO_JOINTING_FIELD_NUMBER: _ClassVar[int]
|
|
227
|
+
WITH_SENSE_FIELD_NUMBER: _ClassVar[int]
|
|
209
228
|
CUSTOM_DICT_NAMES_FIELD_NUMBER: _ClassVar[int]
|
|
210
229
|
sentences: _containers.RepeatedScalarFieldContainer[str]
|
|
211
230
|
language: str
|
|
@@ -213,8 +232,9 @@ class AnalyzeSyntaxListRequest(_message.Message):
|
|
|
213
232
|
custom_domain: str
|
|
214
233
|
auto_spacing: bool
|
|
215
234
|
auto_jointing: bool
|
|
235
|
+
with_sense: bool
|
|
216
236
|
custom_dict_names: _containers.RepeatedScalarFieldContainer[str]
|
|
217
|
-
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: ...
|
|
218
238
|
|
|
219
239
|
class AnalyzeSyntaxListResponse(_message.Message):
|
|
220
240
|
__slots__ = ("sentences", "language", "tokens_count")
|
|
@@ -1,74 +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\"\xb2\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\"\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\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['_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['_ANALYZESYNTAXRAWREQUEST']._serialized_start=1647
|
|
57
|
-
_globals['_ANALYZESYNTAXRAWREQUEST']._serialized_end=1825
|
|
58
|
-
_globals['_ANALYZESYNTAXLISTREQUEST']._serialized_start=1828
|
|
59
|
-
_globals['_ANALYZESYNTAXLISTREQUEST']._serialized_end=2128
|
|
60
|
-
_globals['_ANALYZESYNTAXLISTRESPONSE']._serialized_start=2131
|
|
61
|
-
_globals['_ANALYZESYNTAXLISTRESPONSE']._serialized_end=2269
|
|
62
|
-
_globals['_TOKENIZEREQUEST']._serialized_start=2272
|
|
63
|
-
_globals['_TOKENIZEREQUEST']._serialized_end=2481
|
|
64
|
-
_globals['_SEGMENT']._serialized_start=2483
|
|
65
|
-
_globals['_SEGMENT']._serialized_end=2550
|
|
66
|
-
_globals['_SEGMENTTOKEN']._serialized_start=2552
|
|
67
|
-
_globals['_SEGMENTTOKEN']._serialized_end=2673
|
|
68
|
-
_globals['_SEGMENTSENTENCE']._serialized_start=2675
|
|
69
|
-
_globals['_SEGMENTSENTENCE']._serialized_end=2776
|
|
70
|
-
_globals['_TOKENIZERESPONSE']._serialized_start=2779
|
|
71
|
-
_globals['_TOKENIZERESPONSE']._serialized_end=2915
|
|
72
|
-
_globals['_LANGUAGESERVICE']._serialized_start=2918
|
|
73
|
-
_globals['_LANGUAGESERVICE']._serialized_end=3258
|
|
74
|
-
# @@protoc_insertion_point(module_scope)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|