Skip to content

Commit

Permalink
docs: add some missing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
BrewingWeasel committed Aug 12, 2024
1 parent 7cb7278 commit c587a32
Show file tree
Hide file tree
Showing 9 changed files with 164 additions and 41 deletions.
18 changes: 18 additions & 0 deletions docs/exporting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Exporting

Kalba can be configured to export words to Anki.
To do so, the user needs to select the deck and note model they wish to use for exports.

Then, each field of the model can be configured to include text.
This text can take the form of variables, which are surrounded by curly braces ({}).
Pressing the circle on the right will pull up a list where the user can select any of the potential variables.

#### Default variables

| Variable | Replacement |
| ---------- | ------------------------------- |
| {def} | All the definitions of the word |
| {word} | The word itself |
| {sentence} | The sentence with the word |

Additionally, the contents of named dictionaries can be included with this syntax: `{def:NAME}`, where NAME is the name of the dictionary.
2 changes: 1 addition & 1 deletion docs/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ If you have stanza enabled (see [Stanza](stanza.md) for the benefits and downsid

Another important setting is the frequency list. This can be used to automatically assign [Word Knowledge](word_knowledge.md) and will have other uses in the future.

Finally, the Grammar Parser section allows writing custom [spyglys](https://github.com/BrewingWeasel/spyglys) code to automatically transform lemmas. See [Writing a custom spyglys parser] or the existing templates for more.
Finally, the Grammar Parser section allows writing custom [spyglys](https://github.com/BrewingWeasel/spyglys) code to automatically transform lemmas. See [Writing a spyglys parser](spyglys_parser.md) or the existing templates for more.
69 changes: 43 additions & 26 deletions docs/reader.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,55 @@

The reader is the most important page in Kalba and can be accessed with the book icon in the navigation menu to the left.

## Modes

The reader view can be used in several different modes:

- File
Kalba can use the contents of a file as the basis for the reader, though this currently only supports raw text files.
- Manual
With this input method, users can input their own text.
- Url
Kalba can automatically fetch (and sometimes parse) the contents of a Url to use as input.
See [input settings](input.md) for more.
- Clipboard
This reader automatically updates its contents every time the clipboard is changed.
This can be very useful in conjunction with other tools such as ASB player.
##### File

Kalba can use the contents of a file as the basis for the reader, though this currently only supports raw text files.

##### Manual

With this input method, users can input their own text.

##### Url

Kalba can automatically fetch (and sometimes parse) the contents of a Url to use as input.
See [input settings](input.md) for more.

##### Clipboard

This reader automatically updates its contents every time the clipboard is changed.
This can be very useful in conjunction with other tools such as ASB player.

---

## Sections

The reader view itself is composed of three main parts:

- The text
This section includes the main text of the input, with every word color-coded based on [Word Knowledge](word_knowledge.md).
Clicking on any word results in it popping up in the selected word panel.
- Selected word panel
The top of this panel includes the detected lemma (root word) of the selected word, which can be modified.
Pressing the check mark next to the lemma will always apply the same changes that you have made whenever this lemma is encountered.
#### The text

This section includes the main text of the input, with every word color-coded based on [Word Knowledge](word_knowledge.md).
Clicking on any word results in it popping up in the selected word panel.

#### Selected word panel

The top of this panel includes the detected lemma (root word) of the selected word, which can be modified.
Pressing the check mark next to the lemma will always apply the same changes that you have made whenever this lemma is encountered.

Underneath the lemma there may be one or more small gray buttons. These can be used to change the detected lemma into another form.
For example, although `singer` is the lemma of `singers`, the definition of `sing` may be more useful to remember.
This detection can be changed in the [grammar settings](grammar.md).

Underneath the lemma there may be one or more small gray buttons. These can be used to change the detected lemma into another form.
For example, although `singer` is the lemma of `singers`, the definition of `sing` may be more useful to remember.
This detection can be changed in the [grammar settings](grammar.md).
The next section is the rating buttons, which allow users to manually update their Word Knowledge.
Underneath the rating buttons are definitions, some of which can be popped out into panels of their own (see [Dictionary settings](dictionaries.md)).

The next section is the rating buttons, which allow users to manually update their Word Knowledge.
Underneath the rating buttons are definitions, some of which can be popped out into panels of their own (see [Dictionary settings](dictionaries.md)).
The bottom of this panel includes information about the grammar of the word in this context.
Additionally, it includes an export button (which can be activated with ctrl-e) for adding cards to Anki.
Shift clicking this button (or pressing ctrl-shift-e) will add the card to Anki without the configuration menu.

The bottom of this panel includes information about the grammar of the word in this context.
Additionally, it includes an export button (which can be activated with ctrl-e) for adding cards to Anki.
Shift clicking this button (or pressing ctrl-shift-e) will add the card to Anki without the configuration menu.
#### The status bar

- The status bar
This bar includes some stats about the current input, the undo and redo buttons, and will eventually include more tools.
This bar includes some stats about the current input, the undo and redo buttons, and will eventually include more tools.
5 changes: 5 additions & 0 deletions docs/spyglys_parser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Writing a Spyglys parser

See the [README of Spyglys](https://github.com/BrewingWeasel/spyglys)

WIP: More complete guide
26 changes: 26 additions & 0 deletions docs/stanza.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Stanza

Kalba comes with builtin Stanza integration.
The primary feature that Stanza provides is intelligent grammatical parsing of the text.
This parsing offers several benefits for [all of Stanza's supported languages](https://stanfordnlp.github.io/stanza/performance.html):

- automatic identification of lemmas/root words
- grammar information (this can be seen in the [reader view](reader.md))
- automatic identification of proper nouns (names, places, etc)
- all proper nouns will automatically be marked as ignored

Note that the first text read with Stanza each session will take several seconds to open.
Future texts will open much quicker.

## Requirements

Installing and using Stanza has several requirements:

- Python (version 3.8 or later)
- Several gigabytes of storage
- All other requirements listed by Stanza

## Enabling

Stanza can be enabled in the [Stanza settings](stanza_settings.md) page.
The first time the user enables Stanza, Kalba will install the package, which will take several minutes and around 5 gigabytes of storage.
5 changes: 5 additions & 0 deletions docs/stanza_settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Stanza Settings

This page allows both installing and toggling [Stanza](stanza.md) on and off.

The [grammar page](grammar.md) of each individual profile can be used to set the stanza model used on a per-language basis.
37 changes: 24 additions & 13 deletions docs/word_knowledge.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,30 @@ By checking the interval rate of the notes, Kalba can automatically keep your Wo

Words can be one of six states

- Unknown:
This is the state that all words begin as.
- Learning:
This state is automatically assigned to words that have been added to Anki but have yet to be reviewed or have an interval of one.
- Recognized:
This state is automatically assigned to words that have an interval of less than 9
- Familiar:
This state is automatically assigned to words that have an interval of less than 23
- Known:
This state is automatically assigned to words that have an interval of over 23.
- Ignored:
If stanza is enabled, any words that are detected as proper nouns will automatically be set to ignored. (TODO: you should be able to disable this feature)
This state is generally meant for names or other "words" the user doesn't want to learn.
##### Unknown

This is the state that all words begin as.

##### Learning

This state is automatically assigned to words that have been added to Anki but have yet to be reviewed or have an interval of one.

##### Recognized

This state is automatically assigned to words that have an interval of less than 9

##### Familiar

This state is automatically assigned to words that have an interval of less than 23

##### Known

This state is automatically assigned to words that have an interval of over 23.

##### Ignored

If stanza is enabled, any words that are detected as proper nouns will automatically be set to ignored. (TODO: you should be able to disable this feature)
This state is generally meant for names or other "words" the user doesn't want to learn.

TODO: You should be able to customize the intervals

Expand Down
34 changes: 34 additions & 0 deletions docs/word_knowledge_settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Word Knowledge Settings

## Frequency

If the user provides a frequency list in the [grammar settings](grammar.md), Kalba can automatically mark the N most common words as known.

## Anki

Kalba can link with Anki decks to automatically and automatically import up-to-date and accurate word knowledge.
This requires the Anki app to be open and the Ankiconnect extension to be installed.

The refresh button will automatically check all notes that may have been reviewed recently and update their knowledge levels.
This is automatically run every time Kalba opens.

Forced refreshes will update the word knowledge of every single card, regardless of the date it was reviewed.
This can be useful when you want to update the parsing of every note.

### Setup

#### Decks

To get started, click the plus button to add a deck, and select the deck you use for learning.
You can add as many decks as needed.

#### Parsers

Each deck should include one note parser for each type of note in the deck.
For example, if a deck includes notes with a note type of `Basic`, `Basic (and reversed)`, and a user defined note type, these should all have their own parser.
Parsers can be added to a deck by clicking the plus button on the specific deck the parser corresponds to.

Each parser must include a note type and the field of the note type in which the word appears.
If needed, the parser can be configured to apply additional modifications to the contents of the field.

In the future, users will be able to define Regex rules to have further control over the detection of the word.
9 changes: 8 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
site_name: Kalba
nav:
- Home: "index.md"
- "Word Knowledge": "word_knowledge.md"
- Concepts:
- "Word Knowledge": "word_knowledge.md"
- Stanza: "stanza.md"
- Usage:
- Reader: "reader.md"
- Configuration:
- Profiles: "profiles.md"
- Grammar: "grammar.md"
- Dictionaries: "dictionaries.md"
- "Word Knowledge": "word_knowledge_settings.md"
- Exporting: "exporting.md"
- Input: "input.md"
- Stanza: "stanza_settings.md"
- "Advanced Configuration":
- "Writing a spyglys parser": "spyglys_parser.md"
theme: readthedocs

0 comments on commit c587a32

Please sign in to comment.