My Thesaurus

approved

by mara-li

Automagically adds tags based on a simple csv file or a Markdown table.

β˜… 10 stars↓ 729 downloadsUpdated 1y agoMIT

My Thesaurus

-> French README

Automagically adds tags based on a thesaurus CSV or a Markdown table.

The plugin searches for the word or series of words in the header (properties), body and title of the note. The word searched for will be :

  • Strictly (without right or left truncation),
  • Case-insensitive (upper or lower case)
  • Accent-sensitive (configurable)

[!TIP]

  • game finds GAME or GamE.
  • card game finds Card Game but not cards games
  • game won't find games, gaming or gameplay
  • cafe will not find cafΓ©.
  • cafΓ© will not find cafe.

πŸ“š Thesaurus Format

The thesaurus must be a table with at last two columns: one for the terms and one for the synonyms. The first row must contain the column headers.

[!TIP]
The thesaurus can be a CSV file like this:

Tag,Synonym
computer,PC
computer,machine
computer,bike

Or in Markdown format:

| Tag       | Synonym   |
|-----------|-----------|
| computer  | PC        |
| computer  | machine   |
| computer  | processor |

[!NOTE] If you choose to use a markdown file, the Markdown table must be the only content in the file. But, you can have a frontmatter at the beginning of the file.

You can have as many synonyms as you want for a term, but you need to duplicate the term in the first column. Moreover, a synonym can be associated with multiple terms, and the synonym can equal to the term itself.

βš™οΈ Settings

  1. Thesaurus: Path to the file containing the thesaurus. The file must be a CSV file and must be in your vault. You can click on the save button to ensure the file is valid (the path is correct, the file exists, and it's well-formed).

[!CAUTION]
If, for some reason, the file is moved, you need to update the path in the settings! It won't be updated automatically.

  1. Separator: The separator used in the CSV file. Supported separators are ,, ;, |, tabulation and markdown. See the note above for the markdown separator.
  2. Column title: The title of the column in the CSV file that contains the tags:
    • Term: Name of the tag column to be added
    • Synonyms: Name of the column of words to be searched in the file (contents and file title).
  3. Included paths: Files in these folders will be included when using the command My Thesaurus: Parse all files. You can separate the paths with a comma, semicolon, or newline. Moreover, regex is supported.

[!TIP]
You can include all the files in your vault by using .* as the path!

  1. Excluded terms: Allow to exclude term using a frontmatter key. Include two settings:
    • Frontmatter key: The key to search in the frontmatter, by default exclude_term
    • Auto-clean: If enabled, the plugin will clean the already existing tags with removing the excluded terms.
  2. Remove accents: If enabled, accents will be suppressed when searching for synonyms. Allows cafΓ© to be recognized by cafe (and vice versa).

πŸ“ Usage

The plugin has two commands:

  1. My Thesaurus: Parse all files: This command will parse all the files in the included paths and add the tags based on the thesaurus. At the end, a message will be displayed with the results, including:
    • Errors: The files that encountered an error and the specific error message.
    • Skipped files: The files that have been skipped because no synonym was found.
    • Success: The files that have been successfully parsed, along with the tags that have been added.
  2. My Thesaurus: Parse current file: This command will parse the current file and add the tags based on the thesaurus.

πŸ“₯ Installation

  • From Obsidian's community plugins
  • Using BRAT with https://github.com/Mara-Li/
  • From the release page:
    • Download the latest release
    • Unzip my-thesaurus.zip in .obsidian/plugins/ path
    • In Obsidian settings, reload the plugin
    • Enable the plugin

🎼 Languages

  • English
  • French

To add a translation:

  1. Fork the repository
  2. Add the translation in the src/i18n/locales folder with the name of the language (ex: fr.json).
    • You can get your locale language from Obsidian using obsidian translation or using the commands (in templater for example) : <% tp.obsidian.moment.locale() %>
    • Copy the content of the en.json file in the new file
    • Translate the content
  3. Edit i18n/i18next.ts :
    • Add import * as <lang> from "./locales/<lang>.json";
    • Edit the ressource part with adding : <lang> : {translation: <lang>}

Credits

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.