Skip to content

Improve the documentation associated with SentenceSplittingMode #39

@garethbirduk

Description

@garethbirduk

Describe the bug
This is an improved documentation suggestion more than a bug.

  1. The expected impact of the enum DeepL.SentenceSplittingMode.cs in DeepL.Translator.TranslateTextAsync is poorly documented.
  2. The expected impact cannot be determined in its corresponding unit test; the tests are poorly implemented as they assert only for a non-exception rather than a positively-expected outcome.

Specifically, if and how a new line character \n may or may not be retained is not explained.

To Reproduce
Steps to reproduce the behavior:

  1. Review the documentation

Enum controlling how input translation text should be split into sentences.

This says nothing for how this input translation text impacts the output translation text.

  1. Review the unit tests
      var translator = CreateTestTranslator();
      const string text = "If the implementation is hard to explain, it's a bad idea.\n" +
                          "If the implementation is easy to explain, it may be a good idea.";

      await translator.TranslateTextAsync(
            text,
            null,
            "DE",
            new TextTranslateOptions { SentenceSplittingMode = SentenceSplittingMode.Off });

Expected behavior

  1. Documentation should be made describing how the enum value impacts our expected output translation text.
  2. Existing unit test should be replaced by unit tests that ensure this expected behaviour is adhered to.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions