Skip to content

Commit

Permalink
Improve docs for Service external API
Browse files Browse the repository at this point in the history
Towards #77.

We improve doxygen compatible documentation for the external API exposed
by Service. There are constructors using marian internal structures
(like Options). But there is also a provision of a string (current
Unified API subsitute for Options) based constructor and should suffice
for a client who wants to not know of marian internals.
  • Loading branch information
Jerin Philip committed Apr 7, 2021
1 parent 2932d53 commit b79c1bc
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/translator/service.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ namespace bergamot {
/// Consumer of bergamot API.
///
/// An example use of this API looks as follows:
///
/// ```cpp
/// options = ...;
/// service = Service(options);
/// std::string input_text = "Hello World";
/// std::future<Response>
/// response = service.translate(std::move(input_text));
/// response.wait();
/// Response result = response.get();
/// ```
///
/// Optionally Service can be initialized by also passing model_memory for
/// purposes of efficiency (which defaults to nullpointer and then reads from
Expand All @@ -44,7 +45,19 @@ class Service {
/// @param shortlistMemory byte array of shortlist (aligned to 64)
explicit Service(Ptr<Options> options, AlignedMemory modelMemory, AlignedMemory shortlistMemory);

explicit Service(Ptr<Options> options) : Service(options, AlignedMemory(), AlignedMemory()){}
/// Construct Service purely from Options. This expects options which
/// marian-decoder expects to be set for loading model shortlist and
/// vocabularies from files in addition to parameters that set unset desired
/// features (e.g: alignments, quality-scores).
///
/// This is equivalent to a call to:
/// ```cpp
/// Service(options, AlignedMemory(), AlignedMemory())
/// ```
/// wherein empty memory is passed and internal flow defaults to file-based
/// model, shortlist loading.
explicit Service(Ptr<Options> options) : Service(options, AlignedMemory(),
AlignedMemory()){}

/// Construct Service from a string configuration.
/// @param [in] config string parsable as YAML expected to adhere with marian
Expand Down

0 comments on commit b79c1bc

Please sign in to comment.