File: orthography.md

package info (click to toggle)
plover 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,356 kB
  • sloc: python: 21,589; sh: 682; ansic: 25; makefile: 11
file content (34 lines) | stat: -rw-r--r-- 1,462 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# `plover.orthography` -- Orthography rules

```{py:module} plover.orthography
```

This module provides functionality for generating candidates from attaching
orthographic suffixes to translated words. The functions below depend on the
orthography rules for the *current* steno system -- see {doc}`system`, and
especially the documentation for
{data}`ORTHOGRAPHY_RULES<plover.system.ORTHOGRAPHY_RULES>`, for more information.

```{function} make_candidates_from_rules(word: str, suffix: str[, check: Function[str, bool]]) -> List[str]
Using the orthography rules of the current system, calculate the possible
results of attaching `suffix` to the root `word`.

Not all of these may be valid words in the system's language;
{func}`add_suffix` will automatically look up candidate words to find the
orthographically-correct translation.

Pass a `check` function to filter out candidate words. In most cases this
will not be needed; by default this is set to `lambda x: True`, returning
*all* candidates.
```

```{function} add_suffix(word: str, suffix: str) -> str
Add the `suffix` to the `word`, calculating candidates from
{func}`make_candidates_from_rules`. If
{data}`ORTHOGRAPHY_WORDS<plover.system.ORTHOGRAPHY_WORDS>` exists, this
looks up the best candidate from the list; if not, Plover does a simple
join and attaches the suffix as is without any spelling changes.

Returns the result of attaching the suffix to the word respecting
orthographic rules.
```