How to access the API
The basic way to access the Bareun API is gRPC.
gRPC is a remote procedure call system created by Google.
Because it is based on protobuf messages, data is compressed in transit.
It also uses the HTTP/2 specification, which not only guarantees speed but lets you use bidirectional streaming, flow control, and asynchronous mode.
Above all, the server can run with a very simple structure and can be easily ported to platforms such as Kubernetes.
Clients are supported in C++, Java, Go, Python, C#, PHP, JavaScript, and more,
so you can use it freely, with no restriction on language.
The libraries provided by default, for Python, Java, JavaScript, R, and so on, all make their calls using gRPC.
Why would you need this?
- You may need to build a new client for a language that is not supported by default.
- You can build .NET, GoLang, and C++ libraries.
- Or you may need a simpler or more sophisticated approach than the one the default libraries take.
Building your own client
The distribution provides the specifications for the two services related to Bareun. The API
specifications are included in the shared/proto folder.
- If you use only the morphological analyzer, there are four proto files,
- and if you also use the Bareun spell checker, there are five files in all.
The listing below shows all five files, including the one for the Bareun spell checker.
$ find bareun-v3.0.0/shared/proto
bareun-v3.0.0/shared/proto/
bareun-v3.0.0/shared/proto/bareun
bareun-v3.0.0/shared/proto/bareun/language_service.proto
bareun-v3.0.0/shared/proto/bareun/lang_common.proto
bareun-v3.0.0/shared/proto/bareun/dict_common.proto
bareun-v3.0.0/shared/proto/bareun/custom_dict.proto
bareun-v3.0.0/shared/proto/bareun/revision_service.proto
To use these in each language, you have to build a new gRPC client library suited to that language.
To do this, you need a tool called protoc.
protoc is part of the standard development toolkit for compiling Google protobuf messages.
You also have to install the gRPC plugin that generates the gRPC library and source code for your language.
For the detailed build environment for each language, see the page introducing the build environment by language, and choose the language you need.
Steps to build it
graph TD
A[Copy protoc] -->B(Compile with protoc)
B --> C[Stub code]
C --> D[Generate your own code]
D --> E[Test and use]