Integration comparison by client: Python / Java / JS / R
Bareun provides clients so you can use it from several languages.
There are Python (bareunpy), Java, JavaScript (JS), and R clients,
and an Elasticsearch integration for search indexing is also available. All of them call the same LanguageService.
This page compares the libraries and call styles of each language in one table and shows a short snippet as a starting point.
Client comparison by language
| Language | Library | Main protocol | Recommended encoding_type |
|---|---|---|---|
| Python | bareunpy 2.0 | Connect-RPC | UTF32 |
| Python | bareunpy 1.x | gRPC | UTF32 |
| Java | Bareun Java client | gRPC | UTF16 |
| JavaScript | connect-web stack | Connect-RPC | UTF16 |
| R | Bareun R client | gRPC | UTF32 |
Why do the recommended encodings differ?
The position (offset) should match how the client language handles strings.
Python and R are code point based, so UTF32; in Java, char is 16 bits, so UTF16;
and std::string in Go and C++ fits UTF8 well. The server computes
positions consistently based on the encoding you request.
Starter snippet by language
from bareunpy import Tagger
tagger = Tagger("koba-XXXX-...", host="api.bareun.ai", port=443)
res = tagger.tags(["안녕하세요. 반갑습니다."])
print(res.pos()) # list of morphemes/POS
from bareunpy import Tagger
tagger = Tagger("koba-XXXX-...", host="api.bareun.ai", port=443)
res = tagger.tags(["안녕하세요. 반갑습니다."])
print(res.pos()) # list of morphemes/POS
// Call LanguageService with the Bareun Java client
BareunLanguageServiceClient client =
new BareunLanguageServiceClient("api.bareun.ai", 443, "koba-XXXX-...");
AnalyzeSyntaxResponse res = client.analyzeSyntax("안녕하세요.", "ko_KR");
import { createConnectTransport } from "@connectrpc/connect-web";
import { createClient } from "@connectrpc/connect";
import { LanguageService } from "./gen/language_service_connect";
const client = createClient(LanguageService,
createConnectTransport({ baseUrl: "https://api.bareun.ai" }));
const res = await client.analyzeSyntax({
document: { content: "안녕하세요.", language: "ko_KR" },
encodingType: "UTF16",
});
library(bareun)
tagger <- Tagger(apikey = "koba-XXXX-...", host = "api.bareun.ai", port = 443)
res <- tags(tagger, c("안녕하세요. 반갑습니다."))
print(pos(res))
Things to check in common
- Address:
api.bareun.ai:443(TLS) for the cloud,localhost:5656for installed and Docker distributions. - API key: Set the key that starts with
koba-in the client. - Custom dictionary: In any language you can specify several dictionaries with
custom_dict_names, and the dictionary specified first takes priority.
Frequently asked questions
Q. Which language clients does Bareun provide?
It provides Python (bareunpy), Java, JavaScript (connect-web), and R clients.
All of them call the same LanguageService, so the structure of the analysis result is the same.
Q. Do I need to use a different encoding_type for each language?
It is best to match the position (offset) to the client's string handling. Python and R usually fit UTF32,
and Java and JS fit UTF16. The server computes positions based on the encoding you request.
Q. Why does only the JS client use a different protocol?
Browsers cannot easily call standard gRPC directly, so JS uses Connect-RPC (connect-web). Python 2.0 also switched to Connect-RPC. Java and R use gRPC.
Q. How do I install the Python client?
Install it with pip install bareunpy. After installing, pass the koba- API key and the address
(api.bareun.ai:443 for the cloud, localhost:5656 for an installed server) to Tagger and call LanguageService.
Q. Can I use Bareun with Elasticsearch too?
Yes. Besides Python, Java, JavaScript, and R, Bareun also provides an Elasticsearch integration. It is used to improve index quality by applying Korean morphological analysis and tokenization at the search indexing stage.