Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: added nouns and scripts to make it easier
Elijah Potter8f108ecf32c8
diff --git a/harper-cli/src/main.rs b/harper-cli/src/main.rsindex 2ff8044b9..21b58024f 100644--- a/harper-cli/src/main.rs+++ b/harper-cli/src/main.rs@@ -1,5 +1,6 @@#![doc = include_str!("../README.md")]+use std::iter::once;use std::path::{Path, PathBuf};use anyhow::format_err;@@ -8,7 +9,7 @@ use clap::Parser;use harper_comments::CommentParser;use harper_core::linting::{LintGroup, LintGroupConfig, Linter};use harper_core::parsers::Markdown;-use harper_core::{remove_overlaps, Document, FullDictionary};+use harper_core::{remove_overlaps, Dictionary, Document, FullDictionary};#[derive(Debug, Parser)]enum Args {@@ -25,7 +26,9 @@ enum Args {Parse {/// The file you wish to parse.file: PathBuf- }+ },+ /// Emit decompressed, line-separated list of words in Harper's dictionary.+ Words}fn main() -> anyhow::Result<()> {@@ -79,6 +82,20 @@ fn main() -> anyhow::Result<()> {println!("{:?}", token);}+ Ok(())+ }+ Args::Words => {+ let dict = FullDictionary::curated();++ let mut word_str = String::new();++ for word in dict.words_iter() {+ word_str.clear();+ word_str.extend(word);++ println!("{}", word_str);+ }+Ok(())}}diff --git a/harper-core/dictionary.dict b/harper-core/dictionary.dictindex ee0fb8936..5015a0fa3 100644--- a/harper-core/dictionary.dict+++ b/harper-core/dictionary.dict@@ -2509,6 +2509,7 @@ DPT/1DST/1DTP/1DUI/1+UI/SMDVD/1SDVR/14SMDWI/14@@ -8967,6 +8968,7 @@ Shakespearean/51MShana/2MShandong/2MShane/2M+Shang/SMShanghai/21MShankara/MShanna/2M@@ -17266,6 +17268,7 @@ cognate/51MScognition/1AMcognitional/5cognitive/51Y+subcognitive/51Ycognizable/5cognizance/1AMcognizant/5@@ -22620,6 +22623,7 @@ executive/51SMexecutor/1MSexecutrices/1executrix/1M+executable/1MSexegeses/1exegesis/1Mexegetic/5@@ -49655,3 +49659,30 @@ Wikilink/MS1stacktrace/SM1scrollbar/1SMbreak-up/1SM+sweetgrass/SM+PowerShell/SM+WebSocket/SM+BlasterHacks/SM+Goleman/SM+Kahneman/SM+Graphviz/SM+PTSD/SM+Anker/SM+wikilink/SM+labriola/SM+sioyek/SM+pandoc/SM+Minhaj/SM+Vaadin/SM+CI/SM+archytas/SM+Qin/SM+occipital/SM+onboarding/SM+webpage/SM+Holmdel/SM+Grandey/SM+Foddy/SM+Hasan/SM+Sharman/SM+Labriola/SMdiff --git a/justfile b/justfileindex 3e9df5e26..280936fa8 100644--- a/justfile+++ b/justfile@@ -105,3 +105,31 @@ parse file:lint file:cargo run --bin harper-cli -- lint {{file}}++# Add a noun to Harper's curated dictionary.+addnoun noun:+ #! /bin/bash+ DICT_FILE=./harper-core/dictionary.dict++ cat $DICT_FILE | grep {{noun}}++ if [ $? -eq 0 ]+ then+ echo "That noun may already be in the dictionary."+ exit 0+ fi++ echo "{{noun}}/SM" >> $DICT_FILE++# Search Harper's curated dictionary for a specific word+searchdictfor word:+ cargo run --bin harper-cli -- words | rg {{word}}++# Find words in the user's `harper-ls/dictionary.txt` for words already in the curated dictionary.+userdictoverlap:+ #! /bin/bash+ USER_DICT_FILE="$HOME/.config/harper-ls/dictionary.txt"++ while read -r line; do+ just searchdictfor $line 2> /dev/null+ done < $USER_DICT_FILE