From 16df3356837190db4b957bf8c21cb298bdff6dec Mon Sep 17 00:00:00 2001 From: vqle Date: Thu, 20 Apr 2023 23:05:49 -0400 Subject: [PATCH 01/14] added reverse existence with some basic tests for top1000 words --- .../checks/reverse_existence/__init__.py | 1 + proselint/checks/reverse_existence/top1000.py | 1017 +++++++++++++++++ proselint/config.py | 3 +- proselint/tools.py | 20 + tests/test-proselintrc.json | 3 +- tests/test_reverse_existence.py | 24 + 6 files changed, 1066 insertions(+), 2 deletions(-) create mode 100644 proselint/checks/reverse_existence/__init__.py create mode 100644 proselint/checks/reverse_existence/top1000.py create mode 100644 tests/test_reverse_existence.py diff --git a/proselint/checks/reverse_existence/__init__.py b/proselint/checks/reverse_existence/__init__.py new file mode 100644 index 000000000..ea8887239 --- /dev/null +++ b/proselint/checks/reverse_existence/__init__.py @@ -0,0 +1 @@ +"""Reverse existence.""" diff --git a/proselint/checks/reverse_existence/top1000.py b/proselint/checks/reverse_existence/top1000.py new file mode 100644 index 000000000..c475618b2 --- /dev/null +++ b/proselint/checks/reverse_existence/top1000.py @@ -0,0 +1,1017 @@ +"""Check if the text contains only words in top 1000 most popular words. + +Top 1000. + +""" +from proselint.tools import memoize, reverse_existence_check + + +@memoize +def check(text): + """Check the text.""" + err = "reverse existence.top1000" + msg = "'{}' is not it top 1,000 most popular words." + + popular = [ + "a", + "able", + "about", + "above", + "accept", + "across", + "act", + "actually", + "add", + "admit", + "afraid", + "after", + "afternoon", + "again", + "against", + "age", + "ago", + "agree", + "ah", + "ahead", + "air", + "all", + "allow", + "almost", + "alone", + "along", + "already", + "alright", + "also", + "although", + "always", + "am", + "amaze", + "an", + "and", + "anger", + "angry", + "animal", + "annoy", + "another", + "answer", + "any", + "anymore", + "anyone", + "anything", + "anyway", + "apartment", + "apparently", + "appear", + "approach", + "are", + "area", + "aren't", + "arm", + "around", + "arrive", + "as", + "ask", + "asleep", + "ass", + "at", + "attack", + "attempt", + "attention", + "aunt", + "avoid", + "away", + "baby", + "back", + "bad", + "bag", + "ball", + "band", + "bar", + "barely", + "bathroom", + "be", + "beat", + "beautiful", + "became", + "because", + "become", + "bed", + "bedroom", + "been", + "before", + "began", + "begin", + "behind", + "believe", + "bell", + "beside", + "besides", + "best", + "better", + "between", + "big", + "bit", + "bite", + "black", + "blink", + "block", + "blonde", + "blood", + "blue", + "blush", + "body", + "book", + "bore", + "both", + "bother", + "bottle", + "bottom", + "box", + "boy", + "boyfriend", + "brain", + "break", + "breakfast", + "breath", + "breathe", + "bright", + "bring", + "broke", + "broken", + "brother", + "brought", + "brown", + "brush", + "build", + "burn", + "burst", + "bus", + "business", + "busy", + "but", + "buy", + "by", + "call", + "calm", + "came", + "can", + "can't", + "car", + "card", + "care", + "carefully", + "carry", + "case", + "cat", + "catch", + "caught", + "cause", + "cell", + "chair", + "chance", + "change", + "chase", + "check", + "cheek", + "chest", + "child", + "children", + "chuckle", + "city", + "class", + "clean", + "clear", + "climb", + "close", + "clothes", + "coffee", + "cold", + "college", + "color", + "come", + "comment", + "complete", + "completely", + "computer", + "concern", + "confuse", + "consider", + "continue", + "control", + "conversation", + "cool", + "corner", + "couch", + "could", + "couldn't", + "counter", + "couple", + "course", + "cover", + "crack", + "crazy", + "cross", + "crowd", + "cry", + "cup", + "cut", + "cute", + "dad", + "damn", + "dance", + "dark", + "date", + "daughter", + "day", + "dead", + "deal", + "dear", + "death", + "decide", + "deep", + "definitely", + "desk", + "did", + "didn't", + "die", + "different", + "dinner", + "direction", + "disappear", + "do", + "doctor", + "does", + "doesn't", + "dog", + "don't", + "done", + "door", + "doubt", + "down", + "drag", + "draw", + "dream", + "dress", + "drink", + "drive", + "drop", + "drove", + "dry", + "during", + "each", + "ear", + "early", + "easily", + "easy", + "eat", + "edge", + "either", + "else", + "empty", + "end", + "enjoy", + "enough", + "enter", + "entire", + "escape", + "especially", + "even", + "evening", + "eventually", + "ever", + "every", + "everyone", + "everything", + "exactly", + "except", + "excite", + "exclaim", + "excuse", + "expect", + "explain", + "expression", + "eye", + "eyebrow", + "face", + "fact", + "fall", + "family", + "far", + "fast", + "father", + "fault", + "favorite", + "fear", + "feel", + "feet", + "fell", + "felt", + "few", + "field", + "fight", + "figure", + "fill", + "finally", + "find", + "fine", + "finger", + "finish", + "fire", + "first", + "fit", + "five", + "fix", + "flash", + "flip", + "floor", + "fly", + "focus", + "follow", + "food", + "foot", + "for", + "force", + "forget", + "form", + "forward", + "found", + "four", + "free", + "friend", + "from", + "front", + "frown", + "fuck", + "full", + "fun", + "funny", + "further", + "game", + "gasp", + "gave", + "gaze", + "gently", + "get", + "giggle", + "girl", + "girlfriend", + "give", + "given", + "glad", + "glance", + "glare", + "glass", + "go", + "God", + "gone", + "gonna", + "good", + "got", + "gotten", + "grab", + "great", + "green", + "greet", + "grey", + "grin", + "grip", + "groan", + "ground", + "group", + "grow", + "guard", + "guess", + "gun", + "guy", + "had", + "hadn't", + "hair", + "half", + "hall", + "hallway", + "hand", + "handle", + "hang", + "happen", + "happy", + "hard", + "has", + "hate", + "have", + "haven't", + "he", + "he'd", + "he's", + "head", + "hear", + "heard", + "heart", + "heavy", + "held", + "hell", + "hello", + "help", + "her", + "here", + "herself", + "hey", + "hi", + "hide", + "high", + "him", + "himself", + "his", + "hit", + "hold", + "home", + "hope", + "horse", + "hospital", + "hot", + "hour", + "house", + "how", + "however", + "hug", + "huge", + "huh", + "human", + "hundred", + "hung", + "hurry", + "hurt", + "I", + "I'd", + "I'll", + "I'm", + "I've", + "ice", + "idea", + "if", + "ignore", + "imagine", + "immediately", + "important", + "in", + "inside", + "instead", + "interest", + "interrupt", + "into", + "is", + "isn't", + "it", + "it's", + "its", + "jacket", + "jeans", + "jerk", + "job", + "join", + "joke", + "jump", + "just", + "keep", + "kept", + "key", + "kick", + "kid", + "kill", + "kind", + "kiss", + "kitchen", + "knee", + "knew", + "knock", + "know", + "known", + "lady", + "land", + "large", + "last", + "late", + "laugh", + "lay", + "lead", + "lean", + "learn", + "least", + "leave", + "led", + "left", + "leg", + "less", + "let", + "letter", + "lie", + "life", + "lift", + "light", + "like", + "line", + "lip", + "listen", + "little", + "live", + "lock", + "locker", + "long", + "look", + "lose", + "lost", + "lot", + "loud", + "love", + "low", + "lunch", + "mad", + "made", + "make", + "man", + "manage", + "many", + "mark", + "marry", + "match", + "matter", + "may", + "maybe", + "me", + "mean", + "meant", + "meet", + "memory", + "men", + "mention", + "met", + "middle", + "might", + "mind", + "mine", + "minute", + "mirror", + "miss", + "mom", + "moment", + "money", + "month", + "mood", + "more", + "morning", + "most", + "mother", + "mouth", + "move", + "movie", + "Mr.", + "Mrs.", + "much", + "mum", + "mumble", + "music", + "must", + "mutter", + "my", + "myself", + "name", + "near", + "nearly", + "neck", + "need", + "nervous", + "never", + "new", + "next", + "nice", + "night", + "no", + "nod", + "noise", + "none", + "normal", + "nose", + "not", + "note", + "nothing", + "notice", + "now", + "number", + "obviously", + "of", + "off", + "offer", + "office", + "often", + "oh", + "okay", + "old", + "on", + "once", + "one", + "only", + "onto", + "open", + "or", + "order", + "other", + "our", + "out", + "outside", + "over", + "own", + "pack", + "pain", + "paint", + "pair", + "pants", + "paper", + "parents", + "park", + "part", + "party", + "pass", + "past", + "pause", + "pay", + "people", + "perfect", + "perhaps", + "person", + "phone", + "pick", + "picture", + "piece", + "pink", + "piss", + "place", + "plan", + "play", + "please", + "pocket", + "point", + "police", + "pop", + "position", + "possible", + "power", + "practically", + "present", + "press", + "pretend", + "pretty", + "probably", + "problem", + "promise", + "pull", + "punch", + "push", + "put", + "question", + "quick", + "quickly", + "quiet", + "quietly", + "quite", + "race", + "rain", + "raise", + "ran", + "rang", + "rather", + "reach", + "read", + "ready", + "real", + "realize", + "really", + "reason", + "recognize", + "red", + "relationship", + "relax", + "remain", + "remember", + "remind", + "repeat", + "reply", + "respond", + "rest", + "return", + "ride", + "right", + "ring", + "road", + "rock", + "roll", + "room", + "rose", + "round", + "rub", + "run", + "rush", + "sad", + "safe", + "said", + "same", + "sat", + "save", + "saw", + "say", + "scare", + "school", + "scream", + "search", + "seat", + "second", + "see", + "seem", + "seen", + "self", + "send", + "sense", + "sent", + "serious", + "seriously", + "set", + "settle", + "seven", + "several", + "shadow", + "shake", + "share", + "she", + "she'd", + "she's", + "shift", + "shirt", + "shit", + "shock", + "shoe", + "shook", + "shop", + "short", + "shot", + "should", + "shoulder", + "shouldn't", + "shout", + "shove", + "show", + "shower", + "shrug", + "shut", + "sick", + "side", + "sigh", + "sight", + "sign", + "silence", + "silent", + "simply", + "since", + "single", + "sir", + "sister", + "sit", + "situation", + "six", + "skin", + "sky", + "slam", + "sleep", + "slightly", + "slip", + "slow", + "slowly", + "small", + "smell", + "smile", + "smirk", + "smoke", + "snap", + "so", + "soft", + "softly", + "some", + "somehow", + "someone", + "something", + "sometimes", + "somewhere", + "son", + "song", + "soon", + "sorry", + "sort", + "sound", + "space", + "speak", + "spend", + "spent", + "spoke", + "spot", + "stair", + "stand", + "star", + "stare", + "start", + "state", + "stay", + "step", + "stick", + "still", + "stomach", + "stood", + "stop", + "store", + "story", + "straight", + "strange", + "street", + "strong", + "struggle", + "stuck", + "student", + "study", + "stuff", + "stupid", + "such", + "suck", + "sudden", + "suddenly", + "suggest", + "summer", + "sun", + "suppose", + "sure", + "surprise", + "surround", + "sweet", + "table", + "take", + "taken", + "talk", + "tall", + "teacher", + "team", + "tear", + "teeth", + "tell", + "ten", + "than", + "thank", + "that", + "that's", + "the", + "their", + "them", + "themselves", + "then", + "there", + "there's", + "these", + "they", + "they'd", + "they're", + "thick", + "thing", + "think", + "third", + "this", + "those", + "though", + "thought", + "three", + "threw", + "throat", + "through", + "throw", + "tie", + "tight", + "time", + "tiny", + "tire", + "to", + "today", + "together", + "told", + "tomorrow", + "tone", + "tongue", + "tonight", + "too", + "took", + "top", + "totally", + "touch", + "toward", + "town", + "track", + "trail", + "train", + "tree", + "trip", + "trouble", + "trust", + "truth", + "try", + "turn", + "TV", + "twenty", + "two", + "type", + "uncle", + "under", + "understand", + "until", + "up", + "upon", + "us", + "use", + "usual", + "usually", + "very", + "visit", + "voice", + "wait", + "wake", + "walk", + "wall", + "want", + "warm", + "warn", + "was", + "wasn't", + "watch", + "water", + "wave", + "way", + "we", + "we'll", + "we're", + "we've", + "wear", + "week", + "weird", + "well", + "went", + "were", + "weren't", + "wet", + "what", + "what's", + "whatever", + "when", + "where", + "whether", + "which", + "while", + "whisper", + "white", + "who", + "whole", + "why", + "wide", + "wife", + "will", + "wind", + "window", + "wipe", + "wish", + "with", + "within", + "without", + "woke", + "woman", + "women", + "won't", + "wonder", + "wood", + "word", + "wore", + "work", + "world", + "worry", + "worse", + "would", + "wouldn't", + "wow", + "wrap", + "write", + "wrong", + "yeah", + "year", + "yell", + "yes", + "yet", + "you", + "you'd", + "you'll", + "you're", + "you've", + "young", + "your", + "yourself", + "TRUE" + ] + return reverse_existence_check(text, popular, err, msg) diff --git a/proselint/config.py b/proselint/config.py index 9de52af7e..c527aa5f9 100644 --- a/proselint/config.py +++ b/proselint/config.py @@ -86,6 +86,7 @@ "typography.symbols": True, "uncomparables.misc": True, "weasel_words.misc": True, - "weasel_words.very": True + "weasel_words.very": True, + "reverse_existence.top1000": False } } diff --git a/proselint/tools.py b/proselint/tools.py index e69bf1992..43fcee51a 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -365,6 +365,26 @@ def existence_check(text, list, err, msg, ignore_case=True, str=False, return errors +def reverse_existence_check(text, list, err, msg): + """Build a checker that prohibits words outside of a set.""" + # clean the text of punctuation and lowercasing words in the string + cleaned_text = re.sub(r"[^a-zA-Z0-9 ]+", "", text) + cleaned_text = re.sub(r'[^\w\s]', '', cleaned_text) + cleaned_list = cleaned_text.strip().split() + cleaned_list = [x.casefold() for x in cleaned_list] + lowercase_list = [x.casefold() for x in list] + + # get a list of all words that should not be in the string + words_not_in_list = set(cleaned_list) - set(lowercase_list) + words_not_in_list = [w for w in words_not_in_list] + + # reuse existence check to get the location + # containing the prohibited words + if(len(words_not_in_list) == 0): + return [] + return existence_check(text, words_not_in_list, err, msg) + + def max_errors(limit): """Decorate a check to truncate error output to a specified limit.""" def wrapper(f): diff --git a/tests/test-proselintrc.json b/tests/test-proselintrc.json index ea295608f..14203abd8 100644 --- a/tests/test-proselintrc.json +++ b/tests/test-proselintrc.json @@ -84,6 +84,7 @@ "typography.symbols" : true, "uncomparables.misc" : false, "weasel_words.misc" : true, - "weasel_words.very" : true + "weasel_words.very" : true, + "reverse_existence.top1000" : false } } diff --git a/tests/test_reverse_existence.py b/tests/test_reverse_existence.py new file mode 100644 index 000000000..7313e3c15 --- /dev/null +++ b/tests/test_reverse_existence.py @@ -0,0 +1,24 @@ +"""Tests reverse existence for top1000 and check.""" + +from proselint.checks.reverse_existence import top1000 as chk + +from .check import Check + + +class TestCheck(Check): + """The test class for reverse_existence.top1000.""" + + __test__ = True + + @property + def this_check(self): + """Boilerplate.""" + return chk + + def test_smoke(self): + """Basic smoke test for reverse_existence.top1000.""" + assert self.passes("""I am blonde.""") + assert not self.passes("""I hate broccoli.""") + assert self.passes("""I'm gonna listen to music tonight.""") + assert self.passes("""I will go to sleep because I have school.""") + assert not self.passes("""I am tired.""") From a8dc8c20b542a4a6be94a8075e82d0350de1c58d Mon Sep 17 00:00:00 2001 From: vqle Date: Fri, 21 Apr 2023 00:06:51 -0400 Subject: [PATCH 02/14] added elementary words, docstrings,summary,sources, tests, and linting fixes --- .../checks/reverse_existence/elementary.py | 875 ++++++++++++++++++ proselint/checks/reverse_existence/top1000.py | 9 + proselint/config.py | 3 +- tests/test-proselintrc.json | 3 +- tests/test_reverse_elementary.py | 27 + ...e_existence.py => test_reverse_top1000.py} | 5 +- 6 files changed, 919 insertions(+), 3 deletions(-) create mode 100644 proselint/checks/reverse_existence/elementary.py create mode 100644 tests/test_reverse_elementary.py rename tests/{test_reverse_existence.py => test_reverse_top1000.py} (87%) diff --git a/proselint/checks/reverse_existence/elementary.py b/proselint/checks/reverse_existence/elementary.py new file mode 100644 index 000000000..4d2c8ed2b --- /dev/null +++ b/proselint/checks/reverse_existence/elementary.py @@ -0,0 +1,875 @@ +"""Check if the text contains only words that elementary kids would know. + +--- +layout: Website +source: The Basic Spelling Vocabulary List +source_url: https://tinyurl.com/5n6nczv2 +title: elementary +date: 2023-04-20 11:53:00 +categories: writing +--- + +Elementary + +""" +from proselint.tools import memoize, reverse_existence_check + + +@memoize +def check(text): + """Check the text.""" + err = "reverse existence.top1000" + msg = "'{}' is not a word kids learn in elementary school." + + elementary = [ + "a", + "all", + "am", + "and", + "at", + "ball", + "be", + "bed", + "big", + "book", + "box", + "boy", + "but", + "came", + "can", + "car", + "cat", + "come", + "cow", + "dad", + "day", + "did", + "do", + "dog", + "fat", + "for", + "fun", + "get", + "go", + "good", + "got", + "had", + "hat", + "he", + "hen", + "here", + "him", + "his", + "home", + "hot", + "I", + "if", + "in", + "into", + "is", + "it", + "its", + "let", + "like", + "look", + "man", + "may", + "me", + "mom", + "my", + "no", + "not", + "of", + "oh", + "old", + "on", + "one", + "out", + "pan", + "pet", + "pig", + "play", + "ran", + "rat", + "red", + "ride", + "run", + "sat", + "see", + "she", + "sit", + "six", + "so", + "stop", + "sun", + "ten", + "the", + "this", + "to", + "top", + "toy", + "two", + "up", + "us", + "was", + "we", + "will", + "yes", + "you", + "about", + "add", + "after", + "ago", + "an", + "any", + "apple", + "are", + "as", + "ask", + "ate", + "away", + "baby", + "back", + "bad", + "bag", + "base", + "bat", + "bee", + "been", + "before", + "being", + "best", + "bike", + "bill", + "bird", + "black", + "blue", + "boat", + "both", + "bring", + "brother", + "brown", + "bus", + "buy", + "by", + "cake", + "call", + "candy", + "change", + "child", + "city", + "clean", + "club", + "coat", + "cold", + "coming", + "corn", + "could", + "cry", + "cup", + "cut", + "daddy", + "dear", + "deep", + "deer", + "doing", + "doll", + "door", + "down", + "dress", + "drive", + "drop", + "dry", + "duck", + "each", + "eat", + "eating", + "egg", + "end", + "fall", + "far", + "farm", + "fast", + "father", + "feed", + "feel", + "feet", + "fell", + "find", + "fine", + "fire", + "first", + "fish", + "five", + "fix", + "flag", + "floor", + "fly", + "food", + "foot", + "four", + "fox", + "from", + "full", + "funny", + "game", + "gas", + "gave", + "girl", + "give", + "glad", + "goat", + "goes", + "going", + "gold", + "gone", + "grade", + "grass", + "green", + "grow", + "hand", + "happy", + "hard", + "has", + "have", + "hear", + "help", + "here", + "hill", + "hit", + "hold", + "hole", + "hop", + "hope", + "horse", + "house", + "how", + "ice", + "inch", + "inside", + "job", + "jump", + "just", + "keep", + "king", + "know", + "lake", + "land", + "last", + "late", + "lay", + "left", + "leg", + "light", + "line", + "little", + "live", + "lives", + "long", + "looking", + "lost", + "lot", + "love", + "mad", + "made", + "make", + "many", + "meat", + "men", + "met", + "mile", + "milk", + "mine", + "miss", + "moon", + "more", + "most", + "mother", + "move", + "much", + "must", + "myself", + "nail", + "name", + "need", + "new", + "next", + "nice", + "night", + "nine", + "north", + "now", + "nut", + "off", + "only", + "open", + "or", + "other", + "our", + "outside", + "over", + "page", + "park", + "part", + "pay", + "pick", + "plant", + "playing", + "pony", + "post", + "pull", + "put", + "rabbit", + "rain", + "read", + "rest", + "riding", + "road", + "rock", + "room", + "said", + "same", + "sang", + "saw", + "say", + "school", + "sea", + "seat", + "seem", + "seen", + "send", + "set", + "seven", + "sheep", + "ship", + "shoe", + "show", + "sick", + "side", + "sing", + "sky", + "sleep", + "small", + "snow", + "some", + "soon", + "spell", + "start", + "stay", + "still", + "store", + "story", + "take", + "talk", + "tall", + "teach", + "tell", + "than", + "thank", + "that", + "them", + "then", + "there", + "they", + "thing", + "think", + "three", + "time", + "today", + "told", + "too", + "took", + "train", + "tree", + "truck", + "try", + "use", + "very", + "walk", + "want", + "warm", + "wash", + "way", + "week", + "well", + "went", + "were", + "wet", + "what", + "when", + "while", + "white", + "who", + "why", + "wind", + "wish", + "with", + "woke", + "wood", + "work", + "yellow", + "yet", + "your", + "zoo", + "able", + "above", + "afraid", + "afternoon", + "again", + "age", + "air", + "airplane", + "almost", + "alone", + "along", + "already", + "also", + "always", + "animal", + "another", + "anything", + "around", + "art", + "aunt", + "balloon", + "bark", + "barn", + "basket", + "beach", + "bear", + "because", + "become", + "began", + "begin", + "behind", + "believe", + "below", + "belt", + "better", + "birthday", + "body", + "bones", + "born", + "bought", + "bread", + "bright", + "broke", + "brought", + "busy", + "cabin", + "cage", + "camp", + "can't", + "care", + "carry", + "catch", + "cattle", + "cave", + "children", + "class", + "close", + "cloth", + "coal", + "color", + "corner", + "cotton", + "cover", + "dark", + "desert", + "didn't", + "dinner", + "dishes", + "does", + "done", + "don't", + "dragon", + "draw", + "dream", + "drink", + "early", + "earth", + "east", + "eight", + "even", + "ever", + "every", + "everyone", + "everything", + "eyes", + "face", + "family", + "feeling", + "felt", + "few", + "fight", + "fishing", + "flower", + "flying", + "follow", + "forest", + "forgot", + "form", + "found", + "fourth", + "free", + "Friday", + "friend", + "front", + "getting", + "given", + "grandmother", + "great", + "grew", + "ground", + "guess", + "hair", + "half", + "having", + "head", + "heard", + "he's", + "heat", + "hello", + "high", + "himself", + "hour", + "hundred", + "hurry", + "hurt", + "I'd", + "I'll", + "I'm", + "inches", + "isn't", + "it's", + "I've", + "kept", + "kids", + "kind", + "kitten", + "knew", + "knife", + "lady", + "large", + "largest", + "later", + "learn", + "leave", + "let's", + "letter", + "life", + "list", + "living", + "lovely", + "loving", + "lunch", + "mail", + "making", + "maybe", + "mean", + "merry", + "might", + "mind", + "money", + "month", + "morning", + "mouse", + "mouth", + "Mr.", + "Mrs.", + "Ms.", + "music", + "near", + "nearly", + "never", + "news", + "noise", + "nothing", + "number", + "o'clock", + "often", + "oil", + "once", + "orange", + "order", + "own", + "pair", + "paint", + "paper", + "party", + "pass", + "past", + "penny", + "people", + "person", + "picture", + "place", + "plan", + "plane", + "please", + "pocket", + "point", + "poor", + "race", + "reach", + "reading", + "ready", + "real", + "rich", + "right", + "river", + "rocket", + "rode", + "round", + "rule", + "running", + "salt", + "says", + "sending", + "sent", + "seventh", + "sew", + "shall", + "short", + "shot", + "should", + "sight", + "sister", + "sitting", + "sixth", + "sled", + "smoke", + "soap", + "someone", + "something", + "sometime", + "song", + "sorry", + "sound", + "south", + "space", + "spelling", + "spent", + "sport", + "spring", + "stairs", + "stand", + "state", + "step", + "stick", + "stood", + "stopped", + "stove", + "street", + "strong", + "study", + "such", + "sugar", + "summer", + "Sunday", + "supper", + "table", + "taken", + "taking", + "talking", + "teacher", + "team", + "teeth", + "tenth", + "that's", + "their", + "these", + "thinking", + "third", + "those", + "thought", + "throw", + "tonight", + "trade", + "trick", + "trip", + "trying", + "turn", + "twelve", + "twenty", + "uncle", + "under", + "upon", + "wagon", + "wait", + "walking", + "wasn't", + "watch", + "water", + "weather", + "we're", + "west", + "wheat", + "where", + "which", + "wife", + "wild", + "win", + "window", + "winter", + "without", + "woman", + "won", + "won't", + "wool", + "word", + "working", + "world", + "would", + "write", + "wrong", + "yard", + "year", + "yesterday", + "you're", + "across", + "against", + "answer", + "awhile", + "between", + "board", + "bottom", + "breakfast", + "broken", + "build", + "building", + "built", + "captain", + "carried", + "caught", + "charge", + "chicken", + "circus", + "cities", + "clothes", + "company", + "couldn't", + "country", + "discover", + "doctor", + "doesn't", + "dollar", + "during", + "eighth", + "else", + "enjoy", + "enough", + "everybody", + "example", + "except", + "excuse", + "field", + "fifth", + "finish", + "following", + "good-by", + "group", + "happened", + "harden", + "haven't", + "heavy", + "held", + "hospital", + "idea", + "instead", + "known", + "laugh", + "middle", + "minute", + "mountain", + "ninth", + "ocean", + "office", + "parent", + "peanut", + "pencil", + "picnic", + "police", + "pretty", + "prize", + "quite", + "radio", + "raise", + "really", + "reason", + "remember", + "return", + "Saturday", + "scare", + "second", + "since", + "slowly", + "stories", + "student", + "sudden", + "suit", + "sure", + "swimming", + "though", + "threw", + "tired", + "together", + "tomorrow", + "toward", + "tried", + "trouble", + "truly", + "turtle", + "until", + "village", + "visit", + "wear", + "we'll", + "whole", + "whose", + "women", + "wouldn't", + "writing", + "written", + "wrote", + "yell", + "young", + "although", + "America", + "among", + "arrive", + "attention", + "beautiful", + "countries", + "course", + "cousin", + "decide", + "different", + "evening", + "favorite", + "finally", + "future", + "happiest", + "happiness", + "important", + "interest", + "piece", + "planet", + "present", + "president", + "principal", + "probably", + "problem", + "receive", + "sentence", + "several", + "special", + "suddenly", + "suppose", + "surely", + "surprise", + "they're", + "through", + "usually" + ] + return reverse_existence_check(text, elementary, err, msg) diff --git a/proselint/checks/reverse_existence/top1000.py b/proselint/checks/reverse_existence/top1000.py index c475618b2..03fb681d7 100644 --- a/proselint/checks/reverse_existence/top1000.py +++ b/proselint/checks/reverse_existence/top1000.py @@ -1,5 +1,14 @@ """Check if the text contains only words in top 1000 most popular words. +--- +layout: Website +source: THE UP-GOER FIVE TEXT EDITOR +source_url: https://splasho.com/upgoer5/ +title: ? +date: 2023-04-16 16:32:01 +categories: writing/app +--- + Top 1000. """ diff --git a/proselint/config.py b/proselint/config.py index c527aa5f9..e558a3748 100644 --- a/proselint/config.py +++ b/proselint/config.py @@ -87,6 +87,7 @@ "uncomparables.misc": True, "weasel_words.misc": True, "weasel_words.very": True, - "reverse_existence.top1000": False + "reverse_existence.top1000": False, + "reverse_existence.elementary": False } } diff --git a/tests/test-proselintrc.json b/tests/test-proselintrc.json index 14203abd8..dcd315262 100644 --- a/tests/test-proselintrc.json +++ b/tests/test-proselintrc.json @@ -85,6 +85,7 @@ "uncomparables.misc" : false, "weasel_words.misc" : true, "weasel_words.very" : true, - "reverse_existence.top1000" : false + "reverse_existence.top1000" : false, + "reverse_existence.elementary" : false } } diff --git a/tests/test_reverse_elementary.py b/tests/test_reverse_elementary.py new file mode 100644 index 000000000..8d737fba4 --- /dev/null +++ b/tests/test_reverse_elementary.py @@ -0,0 +1,27 @@ +"""Tests reverse existence for elementary and check.""" + +from proselint.checks.reverse_existence import elementary as chk + +from .check import Check + + +class TestCheck(Check): + """The test class for reverse_existence.elementary.""" + + __test__ = True + + @property + def this_check(self): + """Boilerplate.""" + return chk + + def test_smoke(self): + """Basic smoke test for reverse_existence.elementary.""" + assert self.passes("""A boy and his goat went to a farm.""") + assert self.passes("""I am tired.""") + assert self.passes("""Water make up your body.""") + assert self.passes("""""") + + assert not self.passes(""" Cells make up your body.""") + assert not self.passes("I love clowns.") + assert not self.passes(""" I hate cells and clowns.""") diff --git a/tests/test_reverse_existence.py b/tests/test_reverse_top1000.py similarity index 87% rename from tests/test_reverse_existence.py rename to tests/test_reverse_top1000.py index 7313e3c15..fab8f2fa7 100644 --- a/tests/test_reverse_existence.py +++ b/tests/test_reverse_top1000.py @@ -18,7 +18,10 @@ def this_check(self): def test_smoke(self): """Basic smoke test for reverse_existence.top1000.""" assert self.passes("""I am blonde.""") - assert not self.passes("""I hate broccoli.""") assert self.passes("""I'm gonna listen to music tonight.""") assert self.passes("""I will go to sleep because I have school.""") + assert self.passes("""""") + assert not self.passes("""I am tired.""") + assert not self.passes("""I hate broccoli.""") + assert not self.passes("""I am tired and hate broccoli.""") From fc483ad44190dad4b8626a8178101a063dabe20b Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Fri, 10 May 2024 19:40:58 -0400 Subject: [PATCH 03/14] Rename "reverse_existence" checks to "restricted" Also, factor out word lists into module-level variables, for access from elsewhere. --- proselint/checks/restricted/__init__.py | 1 + proselint/checks/restricted/elementary.py | 877 ++++++++++++++ proselint/checks/restricted/top1000.py | 1028 +++++++++++++++++ .../checks/reverse_existence/__init__.py | 1 - .../checks/reverse_existence/elementary.py | 875 -------------- proselint/checks/reverse_existence/top1000.py | 1026 ---------------- proselint/config.py | 4 +- tests/test-proselintrc.json | 4 +- ...ntary.py => test_restricted_elementary.py} | 6 +- ..._top1000.py => test_restricted_top1000.py} | 6 +- 10 files changed, 1916 insertions(+), 1912 deletions(-) create mode 100644 proselint/checks/restricted/__init__.py create mode 100644 proselint/checks/restricted/elementary.py create mode 100644 proselint/checks/restricted/top1000.py delete mode 100644 proselint/checks/reverse_existence/__init__.py delete mode 100644 proselint/checks/reverse_existence/elementary.py delete mode 100644 proselint/checks/reverse_existence/top1000.py rename tests/{test_reverse_elementary.py => test_restricted_elementary.py} (76%) rename tests/{test_reverse_top1000.py => test_restricted_top1000.py} (78%) diff --git a/proselint/checks/restricted/__init__.py b/proselint/checks/restricted/__init__.py new file mode 100644 index 000000000..4baa6db2b --- /dev/null +++ b/proselint/checks/restricted/__init__.py @@ -0,0 +1 @@ +"""Restricted word lists.""" diff --git a/proselint/checks/restricted/elementary.py b/proselint/checks/restricted/elementary.py new file mode 100644 index 000000000..89e2d1c4e --- /dev/null +++ b/proselint/checks/restricted/elementary.py @@ -0,0 +1,877 @@ +"""Check if the text contains only words that elementary kids would know. + +--- +layout: Website +source: The Basic Spelling Vocabulary List +source_url: https://tinyurl.com/5n6nczv2 +title: elementary +date: 2023-04-20 11:53:00 +categories: writing +--- + +Elementary + +""" +from proselint.tools import memoize, reverse_existence_check + + +ELEMENTARY_WORDS = [ + "a", + "all", + "am", + "and", + "at", + "ball", + "be", + "bed", + "big", + "book", + "box", + "boy", + "but", + "came", + "can", + "car", + "cat", + "come", + "cow", + "dad", + "day", + "did", + "do", + "dog", + "fat", + "for", + "fun", + "get", + "go", + "good", + "got", + "had", + "hat", + "he", + "hen", + "here", + "him", + "his", + "home", + "hot", + "I", + "if", + "in", + "into", + "is", + "it", + "its", + "let", + "like", + "look", + "man", + "may", + "me", + "mom", + "my", + "no", + "not", + "of", + "oh", + "old", + "on", + "one", + "out", + "pan", + "pet", + "pig", + "play", + "ran", + "rat", + "red", + "ride", + "run", + "sat", + "see", + "she", + "sit", + "six", + "so", + "stop", + "sun", + "ten", + "the", + "this", + "to", + "top", + "toy", + "two", + "up", + "us", + "was", + "we", + "will", + "yes", + "you", + "about", + "add", + "after", + "ago", + "an", + "any", + "apple", + "are", + "as", + "ask", + "ate", + "away", + "baby", + "back", + "bad", + "bag", + "base", + "bat", + "bee", + "been", + "before", + "being", + "best", + "bike", + "bill", + "bird", + "black", + "blue", + "boat", + "both", + "bring", + "brother", + "brown", + "bus", + "buy", + "by", + "cake", + "call", + "candy", + "change", + "child", + "city", + "clean", + "club", + "coat", + "cold", + "coming", + "corn", + "could", + "cry", + "cup", + "cut", + "daddy", + "dear", + "deep", + "deer", + "doing", + "doll", + "door", + "down", + "dress", + "drive", + "drop", + "dry", + "duck", + "each", + "eat", + "eating", + "egg", + "end", + "fall", + "far", + "farm", + "fast", + "father", + "feed", + "feel", + "feet", + "fell", + "find", + "fine", + "fire", + "first", + "fish", + "five", + "fix", + "flag", + "floor", + "fly", + "food", + "foot", + "four", + "fox", + "from", + "full", + "funny", + "game", + "gas", + "gave", + "girl", + "give", + "glad", + "goat", + "goes", + "going", + "gold", + "gone", + "grade", + "grass", + "green", + "grow", + "hand", + "happy", + "hard", + "has", + "have", + "hear", + "help", + "here", + "hill", + "hit", + "hold", + "hole", + "hop", + "hope", + "horse", + "house", + "how", + "ice", + "inch", + "inside", + "job", + "jump", + "just", + "keep", + "king", + "know", + "lake", + "land", + "last", + "late", + "lay", + "left", + "leg", + "light", + "line", + "little", + "live", + "lives", + "long", + "looking", + "lost", + "lot", + "love", + "mad", + "made", + "make", + "many", + "meat", + "men", + "met", + "mile", + "milk", + "mine", + "miss", + "moon", + "more", + "most", + "mother", + "move", + "much", + "must", + "myself", + "nail", + "name", + "need", + "new", + "next", + "nice", + "night", + "nine", + "north", + "now", + "nut", + "off", + "only", + "open", + "or", + "other", + "our", + "outside", + "over", + "page", + "park", + "part", + "pay", + "pick", + "plant", + "playing", + "pony", + "post", + "pull", + "put", + "rabbit", + "rain", + "read", + "rest", + "riding", + "road", + "rock", + "room", + "said", + "same", + "sang", + "saw", + "say", + "school", + "sea", + "seat", + "seem", + "seen", + "send", + "set", + "seven", + "sheep", + "ship", + "shoe", + "show", + "sick", + "side", + "sing", + "sky", + "sleep", + "small", + "snow", + "some", + "soon", + "spell", + "start", + "stay", + "still", + "store", + "story", + "take", + "talk", + "tall", + "teach", + "tell", + "than", + "thank", + "that", + "them", + "then", + "there", + "they", + "thing", + "think", + "three", + "time", + "today", + "told", + "too", + "took", + "train", + "tree", + "truck", + "try", + "use", + "very", + "walk", + "want", + "warm", + "wash", + "way", + "week", + "well", + "went", + "were", + "wet", + "what", + "when", + "while", + "white", + "who", + "why", + "wind", + "wish", + "with", + "woke", + "wood", + "work", + "yellow", + "yet", + "your", + "zoo", + "able", + "above", + "afraid", + "afternoon", + "again", + "age", + "air", + "airplane", + "almost", + "alone", + "along", + "already", + "also", + "always", + "animal", + "another", + "anything", + "around", + "art", + "aunt", + "balloon", + "bark", + "barn", + "basket", + "beach", + "bear", + "because", + "become", + "began", + "begin", + "behind", + "believe", + "below", + "belt", + "better", + "birthday", + "body", + "bones", + "born", + "bought", + "bread", + "bright", + "broke", + "brought", + "busy", + "cabin", + "cage", + "camp", + "can't", + "care", + "carry", + "catch", + "cattle", + "cave", + "children", + "class", + "close", + "cloth", + "coal", + "color", + "corner", + "cotton", + "cover", + "dark", + "desert", + "didn't", + "dinner", + "dishes", + "does", + "done", + "don't", + "dragon", + "draw", + "dream", + "drink", + "early", + "earth", + "east", + "eight", + "even", + "ever", + "every", + "everyone", + "everything", + "eyes", + "face", + "family", + "feeling", + "felt", + "few", + "fight", + "fishing", + "flower", + "flying", + "follow", + "forest", + "forgot", + "form", + "found", + "fourth", + "free", + "Friday", + "friend", + "front", + "getting", + "given", + "grandmother", + "great", + "grew", + "ground", + "guess", + "hair", + "half", + "having", + "head", + "heard", + "he's", + "heat", + "hello", + "high", + "himself", + "hour", + "hundred", + "hurry", + "hurt", + "I'd", + "I'll", + "I'm", + "inches", + "isn't", + "it's", + "I've", + "kept", + "kids", + "kind", + "kitten", + "knew", + "knife", + "lady", + "large", + "largest", + "later", + "learn", + "leave", + "let's", + "letter", + "life", + "list", + "living", + "lovely", + "loving", + "lunch", + "mail", + "making", + "maybe", + "mean", + "merry", + "might", + "mind", + "money", + "month", + "morning", + "mouse", + "mouth", + "Mr.", + "Mrs.", + "Ms.", + "music", + "near", + "nearly", + "never", + "news", + "noise", + "nothing", + "number", + "o'clock", + "often", + "oil", + "once", + "orange", + "order", + "own", + "pair", + "paint", + "paper", + "party", + "pass", + "past", + "penny", + "people", + "person", + "picture", + "place", + "plan", + "plane", + "please", + "pocket", + "point", + "poor", + "race", + "reach", + "reading", + "ready", + "real", + "rich", + "right", + "river", + "rocket", + "rode", + "round", + "rule", + "running", + "salt", + "says", + "sending", + "sent", + "seventh", + "sew", + "shall", + "short", + "shot", + "should", + "sight", + "sister", + "sitting", + "sixth", + "sled", + "smoke", + "soap", + "someone", + "something", + "sometime", + "song", + "sorry", + "sound", + "south", + "space", + "spelling", + "spent", + "sport", + "spring", + "stairs", + "stand", + "state", + "step", + "stick", + "stood", + "stopped", + "stove", + "street", + "strong", + "study", + "such", + "sugar", + "summer", + "Sunday", + "supper", + "table", + "taken", + "taking", + "talking", + "teacher", + "team", + "teeth", + "tenth", + "that's", + "their", + "these", + "thinking", + "third", + "those", + "thought", + "throw", + "tonight", + "trade", + "trick", + "trip", + "trying", + "turn", + "twelve", + "twenty", + "uncle", + "under", + "upon", + "wagon", + "wait", + "walking", + "wasn't", + "watch", + "water", + "weather", + "we're", + "west", + "wheat", + "where", + "which", + "wife", + "wild", + "win", + "window", + "winter", + "without", + "woman", + "won", + "won't", + "wool", + "word", + "working", + "world", + "would", + "write", + "wrong", + "yard", + "year", + "yesterday", + "you're", + "across", + "against", + "answer", + "awhile", + "between", + "board", + "bottom", + "breakfast", + "broken", + "build", + "building", + "built", + "captain", + "carried", + "caught", + "charge", + "chicken", + "circus", + "cities", + "clothes", + "company", + "couldn't", + "country", + "discover", + "doctor", + "doesn't", + "dollar", + "during", + "eighth", + "else", + "enjoy", + "enough", + "everybody", + "example", + "except", + "excuse", + "field", + "fifth", + "finish", + "following", + "good-by", + "group", + "happened", + "harden", + "haven't", + "heavy", + "held", + "hospital", + "idea", + "instead", + "known", + "laugh", + "middle", + "minute", + "mountain", + "ninth", + "ocean", + "office", + "parent", + "peanut", + "pencil", + "picnic", + "police", + "pretty", + "prize", + "quite", + "radio", + "raise", + "really", + "reason", + "remember", + "return", + "Saturday", + "scare", + "second", + "since", + "slowly", + "stories", + "student", + "sudden", + "suit", + "sure", + "swimming", + "though", + "threw", + "tired", + "together", + "tomorrow", + "toward", + "tried", + "trouble", + "truly", + "turtle", + "until", + "village", + "visit", + "wear", + "we'll", + "whole", + "whose", + "women", + "wouldn't", + "writing", + "written", + "wrote", + "yell", + "young", + "although", + "America", + "among", + "arrive", + "attention", + "beautiful", + "countries", + "course", + "cousin", + "decide", + "different", + "evening", + "favorite", + "finally", + "future", + "happiest", + "happiness", + "important", + "interest", + "piece", + "planet", + "present", + "president", + "principal", + "probably", + "problem", + "receive", + "sentence", + "several", + "special", + "suddenly", + "suppose", + "surely", + "surprise", + "they're", + "through", + "usually" +] + + +@memoize +def check(text): + """Check the text.""" + err = "restricted.elementary" + msg = "'{}' is not a word kids learn in elementary school." + + return reverse_existence_check(text, ELEMENTARY_WORDS, err, msg) diff --git a/proselint/checks/restricted/top1000.py b/proselint/checks/restricted/top1000.py new file mode 100644 index 000000000..e2ac63398 --- /dev/null +++ b/proselint/checks/restricted/top1000.py @@ -0,0 +1,1028 @@ +"""Check if the text contains only words in top 1000 most popular words. + +--- +layout: Website +source: THE UP-GOER FIVE TEXT EDITOR +source_url: https://splasho.com/upgoer5/ +title: ? +date: 2023-04-16 16:32:01 +categories: writing/app +--- + +Top 1000. + +""" +from proselint.tools import memoize, reverse_existence_check + + +TOP1000_WORDS = [ + "a", + "able", + "about", + "above", + "accept", + "across", + "act", + "actually", + "add", + "admit", + "afraid", + "after", + "afternoon", + "again", + "against", + "age", + "ago", + "agree", + "ah", + "ahead", + "air", + "all", + "allow", + "almost", + "alone", + "along", + "already", + "alright", + "also", + "although", + "always", + "am", + "amaze", + "an", + "and", + "anger", + "angry", + "animal", + "annoy", + "another", + "answer", + "any", + "anymore", + "anyone", + "anything", + "anyway", + "apartment", + "apparently", + "appear", + "approach", + "are", + "area", + "aren't", + "arm", + "around", + "arrive", + "as", + "ask", + "asleep", + "ass", + "at", + "attack", + "attempt", + "attention", + "aunt", + "avoid", + "away", + "baby", + "back", + "bad", + "bag", + "ball", + "band", + "bar", + "barely", + "bathroom", + "be", + "beat", + "beautiful", + "became", + "because", + "become", + "bed", + "bedroom", + "been", + "before", + "began", + "begin", + "behind", + "believe", + "bell", + "beside", + "besides", + "best", + "better", + "between", + "big", + "bit", + "bite", + "black", + "blink", + "block", + "blonde", + "blood", + "blue", + "blush", + "body", + "book", + "bore", + "both", + "bother", + "bottle", + "bottom", + "box", + "boy", + "boyfriend", + "brain", + "break", + "breakfast", + "breath", + "breathe", + "bright", + "bring", + "broke", + "broken", + "brother", + "brought", + "brown", + "brush", + "build", + "burn", + "burst", + "bus", + "business", + "busy", + "but", + "buy", + "by", + "call", + "calm", + "came", + "can", + "can't", + "car", + "card", + "care", + "carefully", + "carry", + "case", + "cat", + "catch", + "caught", + "cause", + "cell", + "chair", + "chance", + "change", + "chase", + "check", + "cheek", + "chest", + "child", + "children", + "chuckle", + "city", + "class", + "clean", + "clear", + "climb", + "close", + "clothes", + "coffee", + "cold", + "college", + "color", + "come", + "comment", + "complete", + "completely", + "computer", + "concern", + "confuse", + "consider", + "continue", + "control", + "conversation", + "cool", + "corner", + "couch", + "could", + "couldn't", + "counter", + "couple", + "course", + "cover", + "crack", + "crazy", + "cross", + "crowd", + "cry", + "cup", + "cut", + "cute", + "dad", + "damn", + "dance", + "dark", + "date", + "daughter", + "day", + "dead", + "deal", + "dear", + "death", + "decide", + "deep", + "definitely", + "desk", + "did", + "didn't", + "die", + "different", + "dinner", + "direction", + "disappear", + "do", + "doctor", + "does", + "doesn't", + "dog", + "don't", + "done", + "door", + "doubt", + "down", + "drag", + "draw", + "dream", + "dress", + "drink", + "drive", + "drop", + "drove", + "dry", + "during", + "each", + "ear", + "early", + "easily", + "easy", + "eat", + "edge", + "either", + "else", + "empty", + "end", + "enjoy", + "enough", + "enter", + "entire", + "escape", + "especially", + "even", + "evening", + "eventually", + "ever", + "every", + "everyone", + "everything", + "exactly", + "except", + "excite", + "exclaim", + "excuse", + "expect", + "explain", + "expression", + "eye", + "eyebrow", + "face", + "fact", + "fall", + "family", + "far", + "fast", + "father", + "fault", + "favorite", + "fear", + "feel", + "feet", + "fell", + "felt", + "few", + "field", + "fight", + "figure", + "fill", + "finally", + "find", + "fine", + "finger", + "finish", + "fire", + "first", + "fit", + "five", + "fix", + "flash", + "flip", + "floor", + "fly", + "focus", + "follow", + "food", + "foot", + "for", + "force", + "forget", + "form", + "forward", + "found", + "four", + "free", + "friend", + "from", + "front", + "frown", + "fuck", + "full", + "fun", + "funny", + "further", + "game", + "gasp", + "gave", + "gaze", + "gently", + "get", + "giggle", + "girl", + "girlfriend", + "give", + "given", + "glad", + "glance", + "glare", + "glass", + "go", + "God", + "gone", + "gonna", + "good", + "got", + "gotten", + "grab", + "great", + "green", + "greet", + "grey", + "grin", + "grip", + "groan", + "ground", + "group", + "grow", + "guard", + "guess", + "gun", + "guy", + "had", + "hadn't", + "hair", + "half", + "hall", + "hallway", + "hand", + "handle", + "hang", + "happen", + "happy", + "hard", + "has", + "hate", + "have", + "haven't", + "he", + "he'd", + "he's", + "head", + "hear", + "heard", + "heart", + "heavy", + "held", + "hell", + "hello", + "help", + "her", + "here", + "herself", + "hey", + "hi", + "hide", + "high", + "him", + "himself", + "his", + "hit", + "hold", + "home", + "hope", + "horse", + "hospital", + "hot", + "hour", + "house", + "how", + "however", + "hug", + "huge", + "huh", + "human", + "hundred", + "hung", + "hurry", + "hurt", + "I", + "I'd", + "I'll", + "I'm", + "I've", + "ice", + "idea", + "if", + "ignore", + "imagine", + "immediately", + "important", + "in", + "inside", + "instead", + "interest", + "interrupt", + "into", + "is", + "isn't", + "it", + "it's", + "its", + "jacket", + "jeans", + "jerk", + "job", + "join", + "joke", + "jump", + "just", + "keep", + "kept", + "key", + "kick", + "kid", + "kill", + "kind", + "kiss", + "kitchen", + "knee", + "knew", + "knock", + "know", + "known", + "lady", + "land", + "large", + "last", + "late", + "laugh", + "lay", + "lead", + "lean", + "learn", + "least", + "leave", + "led", + "left", + "leg", + "less", + "let", + "letter", + "lie", + "life", + "lift", + "light", + "like", + "line", + "lip", + "listen", + "little", + "live", + "lock", + "locker", + "long", + "look", + "lose", + "lost", + "lot", + "loud", + "love", + "low", + "lunch", + "mad", + "made", + "make", + "man", + "manage", + "many", + "mark", + "marry", + "match", + "matter", + "may", + "maybe", + "me", + "mean", + "meant", + "meet", + "memory", + "men", + "mention", + "met", + "middle", + "might", + "mind", + "mine", + "minute", + "mirror", + "miss", + "mom", + "moment", + "money", + "month", + "mood", + "more", + "morning", + "most", + "mother", + "mouth", + "move", + "movie", + "Mr.", + "Mrs.", + "much", + "mum", + "mumble", + "music", + "must", + "mutter", + "my", + "myself", + "name", + "near", + "nearly", + "neck", + "need", + "nervous", + "never", + "new", + "next", + "nice", + "night", + "no", + "nod", + "noise", + "none", + "normal", + "nose", + "not", + "note", + "nothing", + "notice", + "now", + "number", + "obviously", + "of", + "off", + "offer", + "office", + "often", + "oh", + "okay", + "old", + "on", + "once", + "one", + "only", + "onto", + "open", + "or", + "order", + "other", + "our", + "out", + "outside", + "over", + "own", + "pack", + "pain", + "paint", + "pair", + "pants", + "paper", + "parents", + "park", + "part", + "party", + "pass", + "past", + "pause", + "pay", + "people", + "perfect", + "perhaps", + "person", + "phone", + "pick", + "picture", + "piece", + "pink", + "piss", + "place", + "plan", + "play", + "please", + "pocket", + "point", + "police", + "pop", + "position", + "possible", + "power", + "practically", + "present", + "press", + "pretend", + "pretty", + "probably", + "problem", + "promise", + "pull", + "punch", + "push", + "put", + "question", + "quick", + "quickly", + "quiet", + "quietly", + "quite", + "race", + "rain", + "raise", + "ran", + "rang", + "rather", + "reach", + "read", + "ready", + "real", + "realize", + "really", + "reason", + "recognize", + "red", + "relationship", + "relax", + "remain", + "remember", + "remind", + "repeat", + "reply", + "respond", + "rest", + "return", + "ride", + "right", + "ring", + "road", + "rock", + "roll", + "room", + "rose", + "round", + "rub", + "run", + "rush", + "sad", + "safe", + "said", + "same", + "sat", + "save", + "saw", + "say", + "scare", + "school", + "scream", + "search", + "seat", + "second", + "see", + "seem", + "seen", + "self", + "send", + "sense", + "sent", + "serious", + "seriously", + "set", + "settle", + "seven", + "several", + "shadow", + "shake", + "share", + "she", + "she'd", + "she's", + "shift", + "shirt", + "shit", + "shock", + "shoe", + "shook", + "shop", + "short", + "shot", + "should", + "shoulder", + "shouldn't", + "shout", + "shove", + "show", + "shower", + "shrug", + "shut", + "sick", + "side", + "sigh", + "sight", + "sign", + "silence", + "silent", + "simply", + "since", + "single", + "sir", + "sister", + "sit", + "situation", + "six", + "skin", + "sky", + "slam", + "sleep", + "slightly", + "slip", + "slow", + "slowly", + "small", + "smell", + "smile", + "smirk", + "smoke", + "snap", + "so", + "soft", + "softly", + "some", + "somehow", + "someone", + "something", + "sometimes", + "somewhere", + "son", + "song", + "soon", + "sorry", + "sort", + "sound", + "space", + "speak", + "spend", + "spent", + "spoke", + "spot", + "stair", + "stand", + "star", + "stare", + "start", + "state", + "stay", + "step", + "stick", + "still", + "stomach", + "stood", + "stop", + "store", + "story", + "straight", + "strange", + "street", + "strong", + "struggle", + "stuck", + "student", + "study", + "stuff", + "stupid", + "such", + "suck", + "sudden", + "suddenly", + "suggest", + "summer", + "sun", + "suppose", + "sure", + "surprise", + "surround", + "sweet", + "table", + "take", + "taken", + "talk", + "tall", + "teacher", + "team", + "tear", + "teeth", + "tell", + "ten", + "than", + "thank", + "that", + "that's", + "the", + "their", + "them", + "themselves", + "then", + "there", + "there's", + "these", + "they", + "they'd", + "they're", + "thick", + "thing", + "think", + "third", + "this", + "those", + "though", + "thought", + "three", + "threw", + "throat", + "through", + "throw", + "tie", + "tight", + "time", + "tiny", + "tire", + "to", + "today", + "together", + "told", + "tomorrow", + "tone", + "tongue", + "tonight", + "too", + "took", + "top", + "totally", + "touch", + "toward", + "town", + "track", + "trail", + "train", + "tree", + "trip", + "trouble", + "trust", + "truth", + "try", + "turn", + "TV", + "twenty", + "two", + "type", + "uncle", + "under", + "understand", + "until", + "up", + "upon", + "us", + "use", + "usual", + "usually", + "very", + "visit", + "voice", + "wait", + "wake", + "walk", + "wall", + "want", + "warm", + "warn", + "was", + "wasn't", + "watch", + "water", + "wave", + "way", + "we", + "we'll", + "we're", + "we've", + "wear", + "week", + "weird", + "well", + "went", + "were", + "weren't", + "wet", + "what", + "what's", + "whatever", + "when", + "where", + "whether", + "which", + "while", + "whisper", + "white", + "who", + "whole", + "why", + "wide", + "wife", + "will", + "wind", + "window", + "wipe", + "wish", + "with", + "within", + "without", + "woke", + "woman", + "women", + "won't", + "wonder", + "wood", + "word", + "wore", + "work", + "world", + "worry", + "worse", + "would", + "wouldn't", + "wow", + "wrap", + "write", + "wrong", + "yeah", + "year", + "yell", + "yes", + "yet", + "you", + "you'd", + "you'll", + "you're", + "you've", + "young", + "your", + "yourself", + "TRUE", +] + + +@memoize +def check(text): + """Check the text.""" + err = "restricted.top1000" + msg = "'{}' is not in the top 1,000 most popular words." + + return reverse_existence_check(text, TOP1000_WORDS, err, msg) diff --git a/proselint/checks/reverse_existence/__init__.py b/proselint/checks/reverse_existence/__init__.py deleted file mode 100644 index ea8887239..000000000 --- a/proselint/checks/reverse_existence/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Reverse existence.""" diff --git a/proselint/checks/reverse_existence/elementary.py b/proselint/checks/reverse_existence/elementary.py deleted file mode 100644 index 4d2c8ed2b..000000000 --- a/proselint/checks/reverse_existence/elementary.py +++ /dev/null @@ -1,875 +0,0 @@ -"""Check if the text contains only words that elementary kids would know. - ---- -layout: Website -source: The Basic Spelling Vocabulary List -source_url: https://tinyurl.com/5n6nczv2 -title: elementary -date: 2023-04-20 11:53:00 -categories: writing ---- - -Elementary - -""" -from proselint.tools import memoize, reverse_existence_check - - -@memoize -def check(text): - """Check the text.""" - err = "reverse existence.top1000" - msg = "'{}' is not a word kids learn in elementary school." - - elementary = [ - "a", - "all", - "am", - "and", - "at", - "ball", - "be", - "bed", - "big", - "book", - "box", - "boy", - "but", - "came", - "can", - "car", - "cat", - "come", - "cow", - "dad", - "day", - "did", - "do", - "dog", - "fat", - "for", - "fun", - "get", - "go", - "good", - "got", - "had", - "hat", - "he", - "hen", - "here", - "him", - "his", - "home", - "hot", - "I", - "if", - "in", - "into", - "is", - "it", - "its", - "let", - "like", - "look", - "man", - "may", - "me", - "mom", - "my", - "no", - "not", - "of", - "oh", - "old", - "on", - "one", - "out", - "pan", - "pet", - "pig", - "play", - "ran", - "rat", - "red", - "ride", - "run", - "sat", - "see", - "she", - "sit", - "six", - "so", - "stop", - "sun", - "ten", - "the", - "this", - "to", - "top", - "toy", - "two", - "up", - "us", - "was", - "we", - "will", - "yes", - "you", - "about", - "add", - "after", - "ago", - "an", - "any", - "apple", - "are", - "as", - "ask", - "ate", - "away", - "baby", - "back", - "bad", - "bag", - "base", - "bat", - "bee", - "been", - "before", - "being", - "best", - "bike", - "bill", - "bird", - "black", - "blue", - "boat", - "both", - "bring", - "brother", - "brown", - "bus", - "buy", - "by", - "cake", - "call", - "candy", - "change", - "child", - "city", - "clean", - "club", - "coat", - "cold", - "coming", - "corn", - "could", - "cry", - "cup", - "cut", - "daddy", - "dear", - "deep", - "deer", - "doing", - "doll", - "door", - "down", - "dress", - "drive", - "drop", - "dry", - "duck", - "each", - "eat", - "eating", - "egg", - "end", - "fall", - "far", - "farm", - "fast", - "father", - "feed", - "feel", - "feet", - "fell", - "find", - "fine", - "fire", - "first", - "fish", - "five", - "fix", - "flag", - "floor", - "fly", - "food", - "foot", - "four", - "fox", - "from", - "full", - "funny", - "game", - "gas", - "gave", - "girl", - "give", - "glad", - "goat", - "goes", - "going", - "gold", - "gone", - "grade", - "grass", - "green", - "grow", - "hand", - "happy", - "hard", - "has", - "have", - "hear", - "help", - "here", - "hill", - "hit", - "hold", - "hole", - "hop", - "hope", - "horse", - "house", - "how", - "ice", - "inch", - "inside", - "job", - "jump", - "just", - "keep", - "king", - "know", - "lake", - "land", - "last", - "late", - "lay", - "left", - "leg", - "light", - "line", - "little", - "live", - "lives", - "long", - "looking", - "lost", - "lot", - "love", - "mad", - "made", - "make", - "many", - "meat", - "men", - "met", - "mile", - "milk", - "mine", - "miss", - "moon", - "more", - "most", - "mother", - "move", - "much", - "must", - "myself", - "nail", - "name", - "need", - "new", - "next", - "nice", - "night", - "nine", - "north", - "now", - "nut", - "off", - "only", - "open", - "or", - "other", - "our", - "outside", - "over", - "page", - "park", - "part", - "pay", - "pick", - "plant", - "playing", - "pony", - "post", - "pull", - "put", - "rabbit", - "rain", - "read", - "rest", - "riding", - "road", - "rock", - "room", - "said", - "same", - "sang", - "saw", - "say", - "school", - "sea", - "seat", - "seem", - "seen", - "send", - "set", - "seven", - "sheep", - "ship", - "shoe", - "show", - "sick", - "side", - "sing", - "sky", - "sleep", - "small", - "snow", - "some", - "soon", - "spell", - "start", - "stay", - "still", - "store", - "story", - "take", - "talk", - "tall", - "teach", - "tell", - "than", - "thank", - "that", - "them", - "then", - "there", - "they", - "thing", - "think", - "three", - "time", - "today", - "told", - "too", - "took", - "train", - "tree", - "truck", - "try", - "use", - "very", - "walk", - "want", - "warm", - "wash", - "way", - "week", - "well", - "went", - "were", - "wet", - "what", - "when", - "while", - "white", - "who", - "why", - "wind", - "wish", - "with", - "woke", - "wood", - "work", - "yellow", - "yet", - "your", - "zoo", - "able", - "above", - "afraid", - "afternoon", - "again", - "age", - "air", - "airplane", - "almost", - "alone", - "along", - "already", - "also", - "always", - "animal", - "another", - "anything", - "around", - "art", - "aunt", - "balloon", - "bark", - "barn", - "basket", - "beach", - "bear", - "because", - "become", - "began", - "begin", - "behind", - "believe", - "below", - "belt", - "better", - "birthday", - "body", - "bones", - "born", - "bought", - "bread", - "bright", - "broke", - "brought", - "busy", - "cabin", - "cage", - "camp", - "can't", - "care", - "carry", - "catch", - "cattle", - "cave", - "children", - "class", - "close", - "cloth", - "coal", - "color", - "corner", - "cotton", - "cover", - "dark", - "desert", - "didn't", - "dinner", - "dishes", - "does", - "done", - "don't", - "dragon", - "draw", - "dream", - "drink", - "early", - "earth", - "east", - "eight", - "even", - "ever", - "every", - "everyone", - "everything", - "eyes", - "face", - "family", - "feeling", - "felt", - "few", - "fight", - "fishing", - "flower", - "flying", - "follow", - "forest", - "forgot", - "form", - "found", - "fourth", - "free", - "Friday", - "friend", - "front", - "getting", - "given", - "grandmother", - "great", - "grew", - "ground", - "guess", - "hair", - "half", - "having", - "head", - "heard", - "he's", - "heat", - "hello", - "high", - "himself", - "hour", - "hundred", - "hurry", - "hurt", - "I'd", - "I'll", - "I'm", - "inches", - "isn't", - "it's", - "I've", - "kept", - "kids", - "kind", - "kitten", - "knew", - "knife", - "lady", - "large", - "largest", - "later", - "learn", - "leave", - "let's", - "letter", - "life", - "list", - "living", - "lovely", - "loving", - "lunch", - "mail", - "making", - "maybe", - "mean", - "merry", - "might", - "mind", - "money", - "month", - "morning", - "mouse", - "mouth", - "Mr.", - "Mrs.", - "Ms.", - "music", - "near", - "nearly", - "never", - "news", - "noise", - "nothing", - "number", - "o'clock", - "often", - "oil", - "once", - "orange", - "order", - "own", - "pair", - "paint", - "paper", - "party", - "pass", - "past", - "penny", - "people", - "person", - "picture", - "place", - "plan", - "plane", - "please", - "pocket", - "point", - "poor", - "race", - "reach", - "reading", - "ready", - "real", - "rich", - "right", - "river", - "rocket", - "rode", - "round", - "rule", - "running", - "salt", - "says", - "sending", - "sent", - "seventh", - "sew", - "shall", - "short", - "shot", - "should", - "sight", - "sister", - "sitting", - "sixth", - "sled", - "smoke", - "soap", - "someone", - "something", - "sometime", - "song", - "sorry", - "sound", - "south", - "space", - "spelling", - "spent", - "sport", - "spring", - "stairs", - "stand", - "state", - "step", - "stick", - "stood", - "stopped", - "stove", - "street", - "strong", - "study", - "such", - "sugar", - "summer", - "Sunday", - "supper", - "table", - "taken", - "taking", - "talking", - "teacher", - "team", - "teeth", - "tenth", - "that's", - "their", - "these", - "thinking", - "third", - "those", - "thought", - "throw", - "tonight", - "trade", - "trick", - "trip", - "trying", - "turn", - "twelve", - "twenty", - "uncle", - "under", - "upon", - "wagon", - "wait", - "walking", - "wasn't", - "watch", - "water", - "weather", - "we're", - "west", - "wheat", - "where", - "which", - "wife", - "wild", - "win", - "window", - "winter", - "without", - "woman", - "won", - "won't", - "wool", - "word", - "working", - "world", - "would", - "write", - "wrong", - "yard", - "year", - "yesterday", - "you're", - "across", - "against", - "answer", - "awhile", - "between", - "board", - "bottom", - "breakfast", - "broken", - "build", - "building", - "built", - "captain", - "carried", - "caught", - "charge", - "chicken", - "circus", - "cities", - "clothes", - "company", - "couldn't", - "country", - "discover", - "doctor", - "doesn't", - "dollar", - "during", - "eighth", - "else", - "enjoy", - "enough", - "everybody", - "example", - "except", - "excuse", - "field", - "fifth", - "finish", - "following", - "good-by", - "group", - "happened", - "harden", - "haven't", - "heavy", - "held", - "hospital", - "idea", - "instead", - "known", - "laugh", - "middle", - "minute", - "mountain", - "ninth", - "ocean", - "office", - "parent", - "peanut", - "pencil", - "picnic", - "police", - "pretty", - "prize", - "quite", - "radio", - "raise", - "really", - "reason", - "remember", - "return", - "Saturday", - "scare", - "second", - "since", - "slowly", - "stories", - "student", - "sudden", - "suit", - "sure", - "swimming", - "though", - "threw", - "tired", - "together", - "tomorrow", - "toward", - "tried", - "trouble", - "truly", - "turtle", - "until", - "village", - "visit", - "wear", - "we'll", - "whole", - "whose", - "women", - "wouldn't", - "writing", - "written", - "wrote", - "yell", - "young", - "although", - "America", - "among", - "arrive", - "attention", - "beautiful", - "countries", - "course", - "cousin", - "decide", - "different", - "evening", - "favorite", - "finally", - "future", - "happiest", - "happiness", - "important", - "interest", - "piece", - "planet", - "present", - "president", - "principal", - "probably", - "problem", - "receive", - "sentence", - "several", - "special", - "suddenly", - "suppose", - "surely", - "surprise", - "they're", - "through", - "usually" - ] - return reverse_existence_check(text, elementary, err, msg) diff --git a/proselint/checks/reverse_existence/top1000.py b/proselint/checks/reverse_existence/top1000.py deleted file mode 100644 index 03fb681d7..000000000 --- a/proselint/checks/reverse_existence/top1000.py +++ /dev/null @@ -1,1026 +0,0 @@ -"""Check if the text contains only words in top 1000 most popular words. - ---- -layout: Website -source: THE UP-GOER FIVE TEXT EDITOR -source_url: https://splasho.com/upgoer5/ -title: ? -date: 2023-04-16 16:32:01 -categories: writing/app ---- - -Top 1000. - -""" -from proselint.tools import memoize, reverse_existence_check - - -@memoize -def check(text): - """Check the text.""" - err = "reverse existence.top1000" - msg = "'{}' is not it top 1,000 most popular words." - - popular = [ - "a", - "able", - "about", - "above", - "accept", - "across", - "act", - "actually", - "add", - "admit", - "afraid", - "after", - "afternoon", - "again", - "against", - "age", - "ago", - "agree", - "ah", - "ahead", - "air", - "all", - "allow", - "almost", - "alone", - "along", - "already", - "alright", - "also", - "although", - "always", - "am", - "amaze", - "an", - "and", - "anger", - "angry", - "animal", - "annoy", - "another", - "answer", - "any", - "anymore", - "anyone", - "anything", - "anyway", - "apartment", - "apparently", - "appear", - "approach", - "are", - "area", - "aren't", - "arm", - "around", - "arrive", - "as", - "ask", - "asleep", - "ass", - "at", - "attack", - "attempt", - "attention", - "aunt", - "avoid", - "away", - "baby", - "back", - "bad", - "bag", - "ball", - "band", - "bar", - "barely", - "bathroom", - "be", - "beat", - "beautiful", - "became", - "because", - "become", - "bed", - "bedroom", - "been", - "before", - "began", - "begin", - "behind", - "believe", - "bell", - "beside", - "besides", - "best", - "better", - "between", - "big", - "bit", - "bite", - "black", - "blink", - "block", - "blonde", - "blood", - "blue", - "blush", - "body", - "book", - "bore", - "both", - "bother", - "bottle", - "bottom", - "box", - "boy", - "boyfriend", - "brain", - "break", - "breakfast", - "breath", - "breathe", - "bright", - "bring", - "broke", - "broken", - "brother", - "brought", - "brown", - "brush", - "build", - "burn", - "burst", - "bus", - "business", - "busy", - "but", - "buy", - "by", - "call", - "calm", - "came", - "can", - "can't", - "car", - "card", - "care", - "carefully", - "carry", - "case", - "cat", - "catch", - "caught", - "cause", - "cell", - "chair", - "chance", - "change", - "chase", - "check", - "cheek", - "chest", - "child", - "children", - "chuckle", - "city", - "class", - "clean", - "clear", - "climb", - "close", - "clothes", - "coffee", - "cold", - "college", - "color", - "come", - "comment", - "complete", - "completely", - "computer", - "concern", - "confuse", - "consider", - "continue", - "control", - "conversation", - "cool", - "corner", - "couch", - "could", - "couldn't", - "counter", - "couple", - "course", - "cover", - "crack", - "crazy", - "cross", - "crowd", - "cry", - "cup", - "cut", - "cute", - "dad", - "damn", - "dance", - "dark", - "date", - "daughter", - "day", - "dead", - "deal", - "dear", - "death", - "decide", - "deep", - "definitely", - "desk", - "did", - "didn't", - "die", - "different", - "dinner", - "direction", - "disappear", - "do", - "doctor", - "does", - "doesn't", - "dog", - "don't", - "done", - "door", - "doubt", - "down", - "drag", - "draw", - "dream", - "dress", - "drink", - "drive", - "drop", - "drove", - "dry", - "during", - "each", - "ear", - "early", - "easily", - "easy", - "eat", - "edge", - "either", - "else", - "empty", - "end", - "enjoy", - "enough", - "enter", - "entire", - "escape", - "especially", - "even", - "evening", - "eventually", - "ever", - "every", - "everyone", - "everything", - "exactly", - "except", - "excite", - "exclaim", - "excuse", - "expect", - "explain", - "expression", - "eye", - "eyebrow", - "face", - "fact", - "fall", - "family", - "far", - "fast", - "father", - "fault", - "favorite", - "fear", - "feel", - "feet", - "fell", - "felt", - "few", - "field", - "fight", - "figure", - "fill", - "finally", - "find", - "fine", - "finger", - "finish", - "fire", - "first", - "fit", - "five", - "fix", - "flash", - "flip", - "floor", - "fly", - "focus", - "follow", - "food", - "foot", - "for", - "force", - "forget", - "form", - "forward", - "found", - "four", - "free", - "friend", - "from", - "front", - "frown", - "fuck", - "full", - "fun", - "funny", - "further", - "game", - "gasp", - "gave", - "gaze", - "gently", - "get", - "giggle", - "girl", - "girlfriend", - "give", - "given", - "glad", - "glance", - "glare", - "glass", - "go", - "God", - "gone", - "gonna", - "good", - "got", - "gotten", - "grab", - "great", - "green", - "greet", - "grey", - "grin", - "grip", - "groan", - "ground", - "group", - "grow", - "guard", - "guess", - "gun", - "guy", - "had", - "hadn't", - "hair", - "half", - "hall", - "hallway", - "hand", - "handle", - "hang", - "happen", - "happy", - "hard", - "has", - "hate", - "have", - "haven't", - "he", - "he'd", - "he's", - "head", - "hear", - "heard", - "heart", - "heavy", - "held", - "hell", - "hello", - "help", - "her", - "here", - "herself", - "hey", - "hi", - "hide", - "high", - "him", - "himself", - "his", - "hit", - "hold", - "home", - "hope", - "horse", - "hospital", - "hot", - "hour", - "house", - "how", - "however", - "hug", - "huge", - "huh", - "human", - "hundred", - "hung", - "hurry", - "hurt", - "I", - "I'd", - "I'll", - "I'm", - "I've", - "ice", - "idea", - "if", - "ignore", - "imagine", - "immediately", - "important", - "in", - "inside", - "instead", - "interest", - "interrupt", - "into", - "is", - "isn't", - "it", - "it's", - "its", - "jacket", - "jeans", - "jerk", - "job", - "join", - "joke", - "jump", - "just", - "keep", - "kept", - "key", - "kick", - "kid", - "kill", - "kind", - "kiss", - "kitchen", - "knee", - "knew", - "knock", - "know", - "known", - "lady", - "land", - "large", - "last", - "late", - "laugh", - "lay", - "lead", - "lean", - "learn", - "least", - "leave", - "led", - "left", - "leg", - "less", - "let", - "letter", - "lie", - "life", - "lift", - "light", - "like", - "line", - "lip", - "listen", - "little", - "live", - "lock", - "locker", - "long", - "look", - "lose", - "lost", - "lot", - "loud", - "love", - "low", - "lunch", - "mad", - "made", - "make", - "man", - "manage", - "many", - "mark", - "marry", - "match", - "matter", - "may", - "maybe", - "me", - "mean", - "meant", - "meet", - "memory", - "men", - "mention", - "met", - "middle", - "might", - "mind", - "mine", - "minute", - "mirror", - "miss", - "mom", - "moment", - "money", - "month", - "mood", - "more", - "morning", - "most", - "mother", - "mouth", - "move", - "movie", - "Mr.", - "Mrs.", - "much", - "mum", - "mumble", - "music", - "must", - "mutter", - "my", - "myself", - "name", - "near", - "nearly", - "neck", - "need", - "nervous", - "never", - "new", - "next", - "nice", - "night", - "no", - "nod", - "noise", - "none", - "normal", - "nose", - "not", - "note", - "nothing", - "notice", - "now", - "number", - "obviously", - "of", - "off", - "offer", - "office", - "often", - "oh", - "okay", - "old", - "on", - "once", - "one", - "only", - "onto", - "open", - "or", - "order", - "other", - "our", - "out", - "outside", - "over", - "own", - "pack", - "pain", - "paint", - "pair", - "pants", - "paper", - "parents", - "park", - "part", - "party", - "pass", - "past", - "pause", - "pay", - "people", - "perfect", - "perhaps", - "person", - "phone", - "pick", - "picture", - "piece", - "pink", - "piss", - "place", - "plan", - "play", - "please", - "pocket", - "point", - "police", - "pop", - "position", - "possible", - "power", - "practically", - "present", - "press", - "pretend", - "pretty", - "probably", - "problem", - "promise", - "pull", - "punch", - "push", - "put", - "question", - "quick", - "quickly", - "quiet", - "quietly", - "quite", - "race", - "rain", - "raise", - "ran", - "rang", - "rather", - "reach", - "read", - "ready", - "real", - "realize", - "really", - "reason", - "recognize", - "red", - "relationship", - "relax", - "remain", - "remember", - "remind", - "repeat", - "reply", - "respond", - "rest", - "return", - "ride", - "right", - "ring", - "road", - "rock", - "roll", - "room", - "rose", - "round", - "rub", - "run", - "rush", - "sad", - "safe", - "said", - "same", - "sat", - "save", - "saw", - "say", - "scare", - "school", - "scream", - "search", - "seat", - "second", - "see", - "seem", - "seen", - "self", - "send", - "sense", - "sent", - "serious", - "seriously", - "set", - "settle", - "seven", - "several", - "shadow", - "shake", - "share", - "she", - "she'd", - "she's", - "shift", - "shirt", - "shit", - "shock", - "shoe", - "shook", - "shop", - "short", - "shot", - "should", - "shoulder", - "shouldn't", - "shout", - "shove", - "show", - "shower", - "shrug", - "shut", - "sick", - "side", - "sigh", - "sight", - "sign", - "silence", - "silent", - "simply", - "since", - "single", - "sir", - "sister", - "sit", - "situation", - "six", - "skin", - "sky", - "slam", - "sleep", - "slightly", - "slip", - "slow", - "slowly", - "small", - "smell", - "smile", - "smirk", - "smoke", - "snap", - "so", - "soft", - "softly", - "some", - "somehow", - "someone", - "something", - "sometimes", - "somewhere", - "son", - "song", - "soon", - "sorry", - "sort", - "sound", - "space", - "speak", - "spend", - "spent", - "spoke", - "spot", - "stair", - "stand", - "star", - "stare", - "start", - "state", - "stay", - "step", - "stick", - "still", - "stomach", - "stood", - "stop", - "store", - "story", - "straight", - "strange", - "street", - "strong", - "struggle", - "stuck", - "student", - "study", - "stuff", - "stupid", - "such", - "suck", - "sudden", - "suddenly", - "suggest", - "summer", - "sun", - "suppose", - "sure", - "surprise", - "surround", - "sweet", - "table", - "take", - "taken", - "talk", - "tall", - "teacher", - "team", - "tear", - "teeth", - "tell", - "ten", - "than", - "thank", - "that", - "that's", - "the", - "their", - "them", - "themselves", - "then", - "there", - "there's", - "these", - "they", - "they'd", - "they're", - "thick", - "thing", - "think", - "third", - "this", - "those", - "though", - "thought", - "three", - "threw", - "throat", - "through", - "throw", - "tie", - "tight", - "time", - "tiny", - "tire", - "to", - "today", - "together", - "told", - "tomorrow", - "tone", - "tongue", - "tonight", - "too", - "took", - "top", - "totally", - "touch", - "toward", - "town", - "track", - "trail", - "train", - "tree", - "trip", - "trouble", - "trust", - "truth", - "try", - "turn", - "TV", - "twenty", - "two", - "type", - "uncle", - "under", - "understand", - "until", - "up", - "upon", - "us", - "use", - "usual", - "usually", - "very", - "visit", - "voice", - "wait", - "wake", - "walk", - "wall", - "want", - "warm", - "warn", - "was", - "wasn't", - "watch", - "water", - "wave", - "way", - "we", - "we'll", - "we're", - "we've", - "wear", - "week", - "weird", - "well", - "went", - "were", - "weren't", - "wet", - "what", - "what's", - "whatever", - "when", - "where", - "whether", - "which", - "while", - "whisper", - "white", - "who", - "whole", - "why", - "wide", - "wife", - "will", - "wind", - "window", - "wipe", - "wish", - "with", - "within", - "without", - "woke", - "woman", - "women", - "won't", - "wonder", - "wood", - "word", - "wore", - "work", - "world", - "worry", - "worse", - "would", - "wouldn't", - "wow", - "wrap", - "write", - "wrong", - "yeah", - "year", - "yell", - "yes", - "yet", - "you", - "you'd", - "you'll", - "you're", - "you've", - "young", - "your", - "yourself", - "TRUE" - ] - return reverse_existence_check(text, popular, err, msg) diff --git a/proselint/config.py b/proselint/config.py index e558a3748..35daef893 100644 --- a/proselint/config.py +++ b/proselint/config.py @@ -87,7 +87,7 @@ "uncomparables.misc": True, "weasel_words.misc": True, "weasel_words.very": True, - "reverse_existence.top1000": False, - "reverse_existence.elementary": False + "restricted.top1000": False, + "restricted.elementary": False, } } diff --git a/tests/test-proselintrc.json b/tests/test-proselintrc.json index dcd315262..71b6f5921 100644 --- a/tests/test-proselintrc.json +++ b/tests/test-proselintrc.json @@ -85,7 +85,7 @@ "uncomparables.misc" : false, "weasel_words.misc" : true, "weasel_words.very" : true, - "reverse_existence.top1000" : false, - "reverse_existence.elementary" : false + "restricted.top1000" : false, + "restricted.elementary" : false } } diff --git a/tests/test_reverse_elementary.py b/tests/test_restricted_elementary.py similarity index 76% rename from tests/test_reverse_elementary.py rename to tests/test_restricted_elementary.py index 8d737fba4..a6289ca3c 100644 --- a/tests/test_reverse_elementary.py +++ b/tests/test_restricted_elementary.py @@ -1,12 +1,12 @@ """Tests reverse existence for elementary and check.""" -from proselint.checks.reverse_existence import elementary as chk +from proselint.checks.restricted import elementary as chk from .check import Check class TestCheck(Check): - """The test class for reverse_existence.elementary.""" + """The test class for restricted.elementary.""" __test__ = True @@ -16,7 +16,7 @@ def this_check(self): return chk def test_smoke(self): - """Basic smoke test for reverse_existence.elementary.""" + """Basic smoke test for restricted.elementary.""" assert self.passes("""A boy and his goat went to a farm.""") assert self.passes("""I am tired.""") assert self.passes("""Water make up your body.""") diff --git a/tests/test_reverse_top1000.py b/tests/test_restricted_top1000.py similarity index 78% rename from tests/test_reverse_top1000.py rename to tests/test_restricted_top1000.py index fab8f2fa7..3ca2dc0e9 100644 --- a/tests/test_reverse_top1000.py +++ b/tests/test_restricted_top1000.py @@ -1,12 +1,12 @@ """Tests reverse existence for top1000 and check.""" -from proselint.checks.reverse_existence import top1000 as chk +from proselint.checks.restricted import top1000 as chk from .check import Check class TestCheck(Check): - """The test class for reverse_existence.top1000.""" + """The test class for restricted.top1000.""" __test__ = True @@ -16,7 +16,7 @@ def this_check(self): return chk def test_smoke(self): - """Basic smoke test for reverse_existence.top1000.""" + """Basic smoke test for restricted.top1000.""" assert self.passes("""I am blonde.""") assert self.passes("""I'm gonna listen to music tonight.""") assert self.passes("""I will go to sleep because I have school.""") From a5ba44b572e084b0bbb9a1af4e97c85c92b9e170 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Fri, 10 May 2024 19:41:56 -0400 Subject: [PATCH 04/14] tools: New reverse_existence_check implementation Searches for all (3+-character) words using a simple regexp, then walks the `finditer()` of non-overlapping matches, does some sanity-checking on the candidate string (no digits), and queues an error unless it appears on the list of permitted words. --- proselint/tools.py | 62 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/proselint/tools.py b/proselint/tools.py index 43fcee51a..a1370122f 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -365,24 +365,50 @@ def existence_check(text, list, err, msg, ignore_case=True, str=False, return errors -def reverse_existence_check(text, list, err, msg): - """Build a checker that prohibits words outside of a set.""" - # clean the text of punctuation and lowercasing words in the string - cleaned_text = re.sub(r"[^a-zA-Z0-9 ]+", "", text) - cleaned_text = re.sub(r'[^\w\s]', '', cleaned_text) - cleaned_list = cleaned_text.strip().split() - cleaned_list = [x.casefold() for x in cleaned_list] - lowercase_list = [x.casefold() for x in list] - - # get a list of all words that should not be in the string - words_not_in_list = set(cleaned_list) - set(lowercase_list) - words_not_in_list = [w for w in words_not_in_list] - - # reuse existence check to get the location - # containing the prohibited words - if(len(words_not_in_list) == 0): - return [] - return existence_check(text, words_not_in_list, err, msg) +def _case_sensitive_allowed_word(permitted: set[str], match: re.Match): + """Determine if a match object result is in a set of strings.""" + matched = match.string[match.start():match.end()] + return matched in permitted + + +def _case_insensitive_allowed_word(permitted: set[str], match: re.Match): + """Determine if a match object result is in a set, ignoring case.""" + matched = match.string[match.start():match.end()].lower() + return matched in permitted + + +def reverse_existence_check( + text, list, err, msg, ignore_case=True, offset=0 + ): + """Find all words in ``text`` that aren't on the ``list``.""" + if ignore_case: + permitted = set([word.lower() for word in list]) + allowed_word = functools.partial( + _case_insensitive_allowed_word, permitted) + else: + permitted = set(list) + allowed_word = functools.partial( + _case_sensitive_allowed_word, permitted + ) + + # Match all 3+ character words that contain a hyphen or apostrophe + # only in the middle (not as the first or last character) + tokenizer = re.compile(r"\w[\w'-]+\w") + + # Ignore any that contain numerals + exclusions = re.compile(r'[0-9]') + + errors = [( + m.start() + 1 + offset, + m.end() + offset, + err, + msg.format(m.string[m.start():m.end()]), + None) + for m in tokenizer.finditer(text) + if not exclusions.search(m.string[m.start():m.end()]) + and not allowed_word(m) + ] + return errors def max_errors(limit): From af304db8399917077ad5cc2cc2c24ad2203819d2 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Mon, 13 May 2024 12:24:42 -0400 Subject: [PATCH 05/14] Simplify allowed_word helper --- proselint/tools.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/proselint/tools.py b/proselint/tools.py index a1370122f..5e397f07a 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -365,15 +365,11 @@ def existence_check(text, list, err, msg, ignore_case=True, str=False, return errors -def _case_sensitive_allowed_word(permitted: set[str], match: re.Match): +def _allowed_word(permitted: set[str], match: re.Match, /, ignore_case=True): """Determine if a match object result is in a set of strings.""" matched = match.string[match.start():match.end()] - return matched in permitted - - -def _case_insensitive_allowed_word(permitted: set[str], match: re.Match): - """Determine if a match object result is in a set, ignoring case.""" - matched = match.string[match.start():match.end()].lower() + if ignore_case: + return matched.lower() in permitted return matched in permitted @@ -383,13 +379,10 @@ def reverse_existence_check( """Find all words in ``text`` that aren't on the ``list``.""" if ignore_case: permitted = set([word.lower() for word in list]) - allowed_word = functools.partial( - _case_insensitive_allowed_word, permitted) else: permitted = set(list) - allowed_word = functools.partial( - _case_sensitive_allowed_word, permitted - ) + allowed_word = functools.partial( + _allowed_word, permitted, ignore_case=ignore_case) # Match all 3+ character words that contain a hyphen or apostrophe # only in the middle (not as the first or last character) From 63f0a10c6470a4e28f7f7b125c34de60981223ca Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Mon, 13 May 2024 12:39:48 -0400 Subject: [PATCH 06/14] Format list comprehension comprehensibly --- proselint/tools.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/proselint/tools.py b/proselint/tools.py index 5e397f07a..7c5a89f44 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -391,15 +391,15 @@ def reverse_existence_check( # Ignore any that contain numerals exclusions = re.compile(r'[0-9]') - errors = [( - m.start() + 1 + offset, - m.end() + offset, - err, - msg.format(m.string[m.start():m.end()]), - None) + errors = [ + (m.start() + 1 + offset, + m.end() + offset, + err, + msg.format(m.string[m.start():m.end()]), + None) for m in tokenizer.finditer(text) if not exclusions.search(m.string[m.start():m.end()]) - and not allowed_word(m) + and not allowed_word(m) ] return errors From 3eb9696ef90ab40b7754abab619ecf8d82857003 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Mon, 13 May 2024 14:00:14 -0400 Subject: [PATCH 07/14] Switch to CSV for restricted wordlists --- proselint/checks/restricted/elementary.csv | 1 + proselint/checks/restricted/elementary.py | 863 +---------------- proselint/checks/restricted/top1000.csv | 1 + proselint/checks/restricted/top1000.py | 1014 +------------------- pyproject.toml | 1 + 5 files changed, 27 insertions(+), 1853 deletions(-) create mode 100644 proselint/checks/restricted/elementary.csv create mode 100644 proselint/checks/restricted/top1000.csv diff --git a/proselint/checks/restricted/elementary.csv b/proselint/checks/restricted/elementary.csv new file mode 100644 index 000000000..e6e3dfc9e --- /dev/null +++ b/proselint/checks/restricted/elementary.csv @@ -0,0 +1 @@ +a,all,am,and,at,ball,be,bed,big,book,box,boy,but,came,can,car,cat,come,cow,dad,day,did,do,dog,fat,for,fun,get,go,good,got,had,hat,he,hen,here,him,his,home,hot,I,if,in,into,is,it,its,let,like,look,man,may,me,mom,my,no,not,of,oh,old,on,one,out,pan,pet,pig,play,ran,rat,red,ride,run,sat,see,she,sit,six,so,stop,sun,ten,the,this,to,top,toy,two,up,us,was,we,will,yes,you,about,add,after,ago,an,any,apple,are,as,ask,ate,away,baby,back,bad,bag,base,bat,bee,been,before,being,best,bike,bill,bird,black,blue,boat,both,bring,brother,brown,bus,buy,by,cake,call,candy,change,child,city,clean,club,coat,cold,coming,corn,could,cry,cup,cut,daddy,dear,deep,deer,doing,doll,door,down,dress,drive,drop,dry,duck,each,eat,eating,egg,end,fall,far,farm,fast,father,feed,feel,feet,fell,find,fine,fire,first,fish,five,fix,flag,floor,fly,food,foot,four,fox,from,full,funny,game,gas,gave,girl,give,glad,goat,goes,going,gold,gone,grade,grass,green,grow,hand,happy,hard,has,have,hear,help,here,hill,hit,hold,hole,hop,hope,horse,house,how,ice,inch,inside,job,jump,just,keep,king,know,lake,land,last,late,lay,left,leg,light,line,little,live,lives,long,looking,lost,lot,love,mad,made,make,many,meat,men,met,mile,milk,mine,miss,moon,more,most,mother,move,much,must,myself,nail,name,need,new,next,nice,night,nine,north,now,nut,off,only,open,or,other,our,outside,over,page,park,part,pay,pick,plant,playing,pony,post,pull,put,rabbit,rain,read,rest,riding,road,rock,room,said,same,sang,saw,say,school,sea,seat,seem,seen,send,set,seven,sheep,ship,shoe,show,sick,side,sing,sky,sleep,small,snow,some,soon,spell,start,stay,still,store,story,take,talk,tall,teach,tell,than,thank,that,them,then,there,they,thing,think,three,time,today,told,too,took,train,tree,truck,try,use,very,walk,want,warm,wash,way,week,well,went,were,wet,what,when,while,white,who,why,wind,wish,with,woke,wood,work,yellow,yet,your,zoo,able,above,afraid,afternoon,again,age,air,airplane,almost,alone,along,already,also,always,animal,another,anything,around,art,aunt,balloon,bark,barn,basket,beach,bear,because,become,began,begin,behind,believe,below,belt,better,birthday,body,bones,born,bought,bread,bright,broke,brought,busy,cabin,cage,camp,can't,care,carry,catch,cattle,cave,children,class,close,cloth,coal,color,corner,cotton,cover,dark,desert,didn't,dinner,dishes,does,done,don't,dragon,draw,dream,drink,early,earth,east,eight,even,ever,every,everyone,everything,eyes,face,family,feeling,felt,few,fight,fishing,flower,flying,follow,forest,forgot,form,found,fourth,free,Friday,friend,front,getting,given,grandmother,great,grew,ground,guess,hair,half,having,head,heard,he's,heat,hello,high,himself,hour,hundred,hurry,hurt,I'd,I'll,I'm,inches,isn't,it's,I've,kept,kids,kind,kitten,knew,knife,lady,large,largest,later,learn,leave,let's,letter,life,list,living,lovely,loving,lunch,mail,making,maybe,mean,merry,might,mind,money,month,morning,mouse,mouth,Mr.,Mrs.,Ms.,music,near,nearly,never,news,noise,nothing,number,o'clock,often,oil,once,orange,order,own,pair,paint,paper,party,pass,past,penny,people,person,picture,place,plan,plane,please,pocket,point,poor,race,reach,reading,ready,real,rich,right,river,rocket,rode,round,rule,running,salt,says,sending,sent,seventh,sew,shall,short,shot,should,sight,sister,sitting,sixth,sled,smoke,soap,someone,something,sometime,song,sorry,sound,south,space,spelling,spent,sport,spring,stairs,stand,state,step,stick,stood,stopped,stove,street,strong,study,such,sugar,summer,Sunday,supper,table,taken,taking,talking,teacher,team,teeth,tenth,that's,their,these,thinking,third,those,thought,throw,tonight,trade,trick,trip,trying,turn,twelve,twenty,uncle,under,upon,wagon,wait,walking,wasn't,watch,water,weather,we're,west,wheat,where,which,wife,wild,win,window,winter,without,woman,won,won't,wool,word,working,world,would,write,wrong,yard,year,yesterday,you're,across,against,answer,awhile,between,board,bottom,breakfast,broken,build,building,built,captain,carried,caught,charge,chicken,circus,cities,clothes,company,couldn't,country,discover,doctor,doesn't,dollar,during,eighth,else,enjoy,enough,everybody,example,except,excuse,field,fifth,finish,following,good-by,group,happened,harden,haven't,heavy,held,hospital,idea,instead,known,laugh,middle,minute,mountain,ninth,ocean,office,parent,peanut,pencil,picnic,police,pretty,prize,quite,radio,raise,really,reason,remember,return,Saturday,scare,second,since,slowly,stories,student,sudden,suit,sure,swimming,though,threw,tired,together,tomorrow,toward,tried,trouble,truly,turtle,until,village,visit,wear,we'll,whole,whose,women,wouldn't,writing,written,wrote,yell,young,although,America,among,arrive,attention,beautiful,countries,course,cousin,decide,different,evening,favorite,finally,future,happiest,happiness,important,interest,piece,planet,present,president,principal,probably,problem,receive,sentence,several,special,suddenly,suppose,surely,surprise,they're,through,usually diff --git a/proselint/checks/restricted/elementary.py b/proselint/checks/restricted/elementary.py index 89e2d1c4e..8170f53fd 100644 --- a/proselint/checks/restricted/elementary.py +++ b/proselint/checks/restricted/elementary.py @@ -12,860 +12,21 @@ Elementary """ +import csv +try: + from importlib.resources import files +except ImportError: + from importlib_resources import files + +import proselint from proselint.tools import memoize, reverse_existence_check +_CSV_PATH = 'checks/restricted/elementary.csv' +with files(proselint).joinpath(_CSV_PATH).open('r') as data: + reader = csv.reader(data) + wordlist = list(reader).pop() -ELEMENTARY_WORDS = [ - "a", - "all", - "am", - "and", - "at", - "ball", - "be", - "bed", - "big", - "book", - "box", - "boy", - "but", - "came", - "can", - "car", - "cat", - "come", - "cow", - "dad", - "day", - "did", - "do", - "dog", - "fat", - "for", - "fun", - "get", - "go", - "good", - "got", - "had", - "hat", - "he", - "hen", - "here", - "him", - "his", - "home", - "hot", - "I", - "if", - "in", - "into", - "is", - "it", - "its", - "let", - "like", - "look", - "man", - "may", - "me", - "mom", - "my", - "no", - "not", - "of", - "oh", - "old", - "on", - "one", - "out", - "pan", - "pet", - "pig", - "play", - "ran", - "rat", - "red", - "ride", - "run", - "sat", - "see", - "she", - "sit", - "six", - "so", - "stop", - "sun", - "ten", - "the", - "this", - "to", - "top", - "toy", - "two", - "up", - "us", - "was", - "we", - "will", - "yes", - "you", - "about", - "add", - "after", - "ago", - "an", - "any", - "apple", - "are", - "as", - "ask", - "ate", - "away", - "baby", - "back", - "bad", - "bag", - "base", - "bat", - "bee", - "been", - "before", - "being", - "best", - "bike", - "bill", - "bird", - "black", - "blue", - "boat", - "both", - "bring", - "brother", - "brown", - "bus", - "buy", - "by", - "cake", - "call", - "candy", - "change", - "child", - "city", - "clean", - "club", - "coat", - "cold", - "coming", - "corn", - "could", - "cry", - "cup", - "cut", - "daddy", - "dear", - "deep", - "deer", - "doing", - "doll", - "door", - "down", - "dress", - "drive", - "drop", - "dry", - "duck", - "each", - "eat", - "eating", - "egg", - "end", - "fall", - "far", - "farm", - "fast", - "father", - "feed", - "feel", - "feet", - "fell", - "find", - "fine", - "fire", - "first", - "fish", - "five", - "fix", - "flag", - "floor", - "fly", - "food", - "foot", - "four", - "fox", - "from", - "full", - "funny", - "game", - "gas", - "gave", - "girl", - "give", - "glad", - "goat", - "goes", - "going", - "gold", - "gone", - "grade", - "grass", - "green", - "grow", - "hand", - "happy", - "hard", - "has", - "have", - "hear", - "help", - "here", - "hill", - "hit", - "hold", - "hole", - "hop", - "hope", - "horse", - "house", - "how", - "ice", - "inch", - "inside", - "job", - "jump", - "just", - "keep", - "king", - "know", - "lake", - "land", - "last", - "late", - "lay", - "left", - "leg", - "light", - "line", - "little", - "live", - "lives", - "long", - "looking", - "lost", - "lot", - "love", - "mad", - "made", - "make", - "many", - "meat", - "men", - "met", - "mile", - "milk", - "mine", - "miss", - "moon", - "more", - "most", - "mother", - "move", - "much", - "must", - "myself", - "nail", - "name", - "need", - "new", - "next", - "nice", - "night", - "nine", - "north", - "now", - "nut", - "off", - "only", - "open", - "or", - "other", - "our", - "outside", - "over", - "page", - "park", - "part", - "pay", - "pick", - "plant", - "playing", - "pony", - "post", - "pull", - "put", - "rabbit", - "rain", - "read", - "rest", - "riding", - "road", - "rock", - "room", - "said", - "same", - "sang", - "saw", - "say", - "school", - "sea", - "seat", - "seem", - "seen", - "send", - "set", - "seven", - "sheep", - "ship", - "shoe", - "show", - "sick", - "side", - "sing", - "sky", - "sleep", - "small", - "snow", - "some", - "soon", - "spell", - "start", - "stay", - "still", - "store", - "story", - "take", - "talk", - "tall", - "teach", - "tell", - "than", - "thank", - "that", - "them", - "then", - "there", - "they", - "thing", - "think", - "three", - "time", - "today", - "told", - "too", - "took", - "train", - "tree", - "truck", - "try", - "use", - "very", - "walk", - "want", - "warm", - "wash", - "way", - "week", - "well", - "went", - "were", - "wet", - "what", - "when", - "while", - "white", - "who", - "why", - "wind", - "wish", - "with", - "woke", - "wood", - "work", - "yellow", - "yet", - "your", - "zoo", - "able", - "above", - "afraid", - "afternoon", - "again", - "age", - "air", - "airplane", - "almost", - "alone", - "along", - "already", - "also", - "always", - "animal", - "another", - "anything", - "around", - "art", - "aunt", - "balloon", - "bark", - "barn", - "basket", - "beach", - "bear", - "because", - "become", - "began", - "begin", - "behind", - "believe", - "below", - "belt", - "better", - "birthday", - "body", - "bones", - "born", - "bought", - "bread", - "bright", - "broke", - "brought", - "busy", - "cabin", - "cage", - "camp", - "can't", - "care", - "carry", - "catch", - "cattle", - "cave", - "children", - "class", - "close", - "cloth", - "coal", - "color", - "corner", - "cotton", - "cover", - "dark", - "desert", - "didn't", - "dinner", - "dishes", - "does", - "done", - "don't", - "dragon", - "draw", - "dream", - "drink", - "early", - "earth", - "east", - "eight", - "even", - "ever", - "every", - "everyone", - "everything", - "eyes", - "face", - "family", - "feeling", - "felt", - "few", - "fight", - "fishing", - "flower", - "flying", - "follow", - "forest", - "forgot", - "form", - "found", - "fourth", - "free", - "Friday", - "friend", - "front", - "getting", - "given", - "grandmother", - "great", - "grew", - "ground", - "guess", - "hair", - "half", - "having", - "head", - "heard", - "he's", - "heat", - "hello", - "high", - "himself", - "hour", - "hundred", - "hurry", - "hurt", - "I'd", - "I'll", - "I'm", - "inches", - "isn't", - "it's", - "I've", - "kept", - "kids", - "kind", - "kitten", - "knew", - "knife", - "lady", - "large", - "largest", - "later", - "learn", - "leave", - "let's", - "letter", - "life", - "list", - "living", - "lovely", - "loving", - "lunch", - "mail", - "making", - "maybe", - "mean", - "merry", - "might", - "mind", - "money", - "month", - "morning", - "mouse", - "mouth", - "Mr.", - "Mrs.", - "Ms.", - "music", - "near", - "nearly", - "never", - "news", - "noise", - "nothing", - "number", - "o'clock", - "often", - "oil", - "once", - "orange", - "order", - "own", - "pair", - "paint", - "paper", - "party", - "pass", - "past", - "penny", - "people", - "person", - "picture", - "place", - "plan", - "plane", - "please", - "pocket", - "point", - "poor", - "race", - "reach", - "reading", - "ready", - "real", - "rich", - "right", - "river", - "rocket", - "rode", - "round", - "rule", - "running", - "salt", - "says", - "sending", - "sent", - "seventh", - "sew", - "shall", - "short", - "shot", - "should", - "sight", - "sister", - "sitting", - "sixth", - "sled", - "smoke", - "soap", - "someone", - "something", - "sometime", - "song", - "sorry", - "sound", - "south", - "space", - "spelling", - "spent", - "sport", - "spring", - "stairs", - "stand", - "state", - "step", - "stick", - "stood", - "stopped", - "stove", - "street", - "strong", - "study", - "such", - "sugar", - "summer", - "Sunday", - "supper", - "table", - "taken", - "taking", - "talking", - "teacher", - "team", - "teeth", - "tenth", - "that's", - "their", - "these", - "thinking", - "third", - "those", - "thought", - "throw", - "tonight", - "trade", - "trick", - "trip", - "trying", - "turn", - "twelve", - "twenty", - "uncle", - "under", - "upon", - "wagon", - "wait", - "walking", - "wasn't", - "watch", - "water", - "weather", - "we're", - "west", - "wheat", - "where", - "which", - "wife", - "wild", - "win", - "window", - "winter", - "without", - "woman", - "won", - "won't", - "wool", - "word", - "working", - "world", - "would", - "write", - "wrong", - "yard", - "year", - "yesterday", - "you're", - "across", - "against", - "answer", - "awhile", - "between", - "board", - "bottom", - "breakfast", - "broken", - "build", - "building", - "built", - "captain", - "carried", - "caught", - "charge", - "chicken", - "circus", - "cities", - "clothes", - "company", - "couldn't", - "country", - "discover", - "doctor", - "doesn't", - "dollar", - "during", - "eighth", - "else", - "enjoy", - "enough", - "everybody", - "example", - "except", - "excuse", - "field", - "fifth", - "finish", - "following", - "good-by", - "group", - "happened", - "harden", - "haven't", - "heavy", - "held", - "hospital", - "idea", - "instead", - "known", - "laugh", - "middle", - "minute", - "mountain", - "ninth", - "ocean", - "office", - "parent", - "peanut", - "pencil", - "picnic", - "police", - "pretty", - "prize", - "quite", - "radio", - "raise", - "really", - "reason", - "remember", - "return", - "Saturday", - "scare", - "second", - "since", - "slowly", - "stories", - "student", - "sudden", - "suit", - "sure", - "swimming", - "though", - "threw", - "tired", - "together", - "tomorrow", - "toward", - "tried", - "trouble", - "truly", - "turtle", - "until", - "village", - "visit", - "wear", - "we'll", - "whole", - "whose", - "women", - "wouldn't", - "writing", - "written", - "wrote", - "yell", - "young", - "although", - "America", - "among", - "arrive", - "attention", - "beautiful", - "countries", - "course", - "cousin", - "decide", - "different", - "evening", - "favorite", - "finally", - "future", - "happiest", - "happiness", - "important", - "interest", - "piece", - "planet", - "present", - "president", - "principal", - "probably", - "problem", - "receive", - "sentence", - "several", - "special", - "suddenly", - "suppose", - "surely", - "surprise", - "they're", - "through", - "usually" -] +ELEMENTARY_WORDS = wordlist @memoize diff --git a/proselint/checks/restricted/top1000.csv b/proselint/checks/restricted/top1000.csv new file mode 100644 index 000000000..4a73cfa8e --- /dev/null +++ b/proselint/checks/restricted/top1000.csv @@ -0,0 +1 @@ +a,able,about,above,accept,across,act,actually,add,admit,afraid,after,afternoon,again,against,age,ago,agree,ah,ahead,air,all,allow,almost,alone,along,already,alright,also,although,always,am,amaze,an,and,anger,angry,animal,annoy,another,answer,any,anymore,anyone,anything,anyway,apartment,apparently,appear,approach,are,area,aren't,arm,around,arrive,as,ask,asleep,ass,at,attack,attempt,attention,aunt,avoid,away,baby,back,bad,bag,ball,band,bar,barely,bathroom,be,beat,beautiful,became,because,become,bed,bedroom,been,before,began,begin,behind,believe,bell,beside,besides,best,better,between,big,bit,bite,black,blink,block,blonde,blood,blue,blush,body,book,bore,both,bother,bottle,bottom,box,boy,boyfriend,brain,break,breakfast,breath,breathe,bright,bring,broke,broken,brother,brought,brown,brush,build,burn,burst,bus,business,busy,but,buy,by,call,calm,came,can,can't,car,card,care,carefully,carry,case,cat,catch,caught,cause,cell,chair,chance,change,chase,check,cheek,chest,child,children,chuckle,city,class,clean,clear,climb,close,clothes,coffee,cold,college,color,come,comment,complete,completely,computer,concern,confuse,consider,continue,control,conversation,cool,corner,couch,could,couldn't,counter,couple,course,cover,crack,crazy,cross,crowd,cry,cup,cut,cute,dad,damn,dance,dark,date,daughter,day,dead,deal,dear,death,decide,deep,definitely,desk,did,didn't,die,different,dinner,direction,disappear,do,doctor,does,doesn't,dog,don't,done,door,doubt,down,drag,draw,dream,dress,drink,drive,drop,drove,dry,during,each,ear,early,easily,easy,eat,edge,either,else,empty,end,enjoy,enough,enter,entire,escape,especially,even,evening,eventually,ever,every,everyone,everything,exactly,except,excite,exclaim,excuse,expect,explain,expression,eye,eyebrow,face,fact,fall,family,far,fast,father,fault,favorite,fear,feel,feet,fell,felt,few,field,fight,figure,fill,finally,find,fine,finger,finish,fire,first,fit,five,fix,flash,flip,floor,fly,focus,follow,food,foot,for,force,forget,form,forward,found,four,free,friend,from,front,frown,fuck,full,fun,funny,further,game,gasp,gave,gaze,gently,get,giggle,girl,girlfriend,give,given,glad,glance,glare,glass,go,God,gone,gonna,good,got,gotten,grab,great,green,greet,grey,grin,grip,groan,ground,group,grow,guard,guess,gun,guy,had,hadn't,hair,half,hall,hallway,hand,handle,hang,happen,happy,hard,has,hate,have,haven't,he,he'd,he's,head,hear,heard,heart,heavy,held,hell,hello,help,her,here,herself,hey,hi,hide,high,him,himself,his,hit,hold,home,hope,horse,hospital,hot,hour,house,how,however,hug,huge,huh,human,hundred,hung,hurry,hurt,I,I'd,I'll,I'm,I've,ice,idea,if,ignore,imagine,immediately,important,in,inside,instead,interest,interrupt,into,is,isn't,it,it's,its,jacket,jeans,jerk,job,join,joke,jump,just,keep,kept,key,kick,kid,kill,kind,kiss,kitchen,knee,knew,knock,know,known,lady,land,large,last,late,laugh,lay,lead,lean,learn,least,leave,led,left,leg,less,let,letter,lie,life,lift,light,like,line,lip,listen,little,live,lock,locker,long,look,lose,lost,lot,loud,love,low,lunch,mad,made,make,man,manage,many,mark,marry,match,matter,may,maybe,me,mean,meant,meet,memory,men,mention,met,middle,might,mind,mine,minute,mirror,miss,mom,moment,money,month,mood,more,morning,most,mother,mouth,move,movie,Mr.,Mrs.,much,mum,mumble,music,must,mutter,my,myself,name,near,nearly,neck,need,nervous,never,new,next,nice,night,no,nod,noise,none,normal,nose,not,note,nothing,notice,now,number,obviously,of,off,offer,office,often,oh,okay,old,on,once,one,only,onto,open,or,order,other,our,out,outside,over,own,pack,pain,paint,pair,pants,paper,parents,park,part,party,pass,past,pause,pay,people,perfect,perhaps,person,phone,pick,picture,piece,pink,piss,place,plan,play,please,pocket,point,police,pop,position,possible,power,practically,present,press,pretend,pretty,probably,problem,promise,pull,punch,push,put,question,quick,quickly,quiet,quietly,quite,race,rain,raise,ran,rang,rather,reach,read,ready,real,realize,really,reason,recognize,red,relationship,relax,remain,remember,remind,repeat,reply,respond,rest,return,ride,right,ring,road,rock,roll,room,rose,round,rub,run,rush,sad,safe,said,same,sat,save,saw,say,scare,school,scream,search,seat,second,see,seem,seen,self,send,sense,sent,serious,seriously,set,settle,seven,several,shadow,shake,share,she,she'd,she's,shift,shirt,shit,shock,shoe,shook,shop,short,shot,should,shoulder,shouldn't,shout,shove,show,shower,shrug,shut,sick,side,sigh,sight,sign,silence,silent,simply,since,single,sir,sister,sit,situation,six,skin,sky,slam,sleep,slightly,slip,slow,slowly,small,smell,smile,smirk,smoke,snap,so,soft,softly,some,somehow,someone,something,sometimes,somewhere,son,song,soon,sorry,sort,sound,space,speak,spend,spent,spoke,spot,stair,stand,star,stare,start,state,stay,step,stick,still,stomach,stood,stop,store,story,straight,strange,street,strong,struggle,stuck,student,study,stuff,stupid,such,suck,sudden,suddenly,suggest,summer,sun,suppose,sure,surprise,surround,sweet,table,take,taken,talk,tall,teacher,team,tear,teeth,tell,ten,than,thank,that,that's,the,their,them,themselves,then,there,there's,these,they,they'd,they're,thick,thing,think,third,this,those,though,thought,three,threw,throat,through,throw,tie,tight,time,tiny,tire,to,today,together,told,tomorrow,tone,tongue,tonight,too,took,top,totally,touch,toward,town,track,trail,train,tree,trip,trouble,trust,truth,try,turn,TV,twenty,two,type,uncle,under,understand,until,up,upon,us,use,usual,usually,very,visit,voice,wait,wake,walk,wall,want,warm,warn,was,wasn't,watch,water,wave,way,we,we'll,we're,we've,wear,week,weird,well,went,were,weren't,wet,what,what's,whatever,when,where,whether,which,while,whisper,white,who,whole,why,wide,wife,will,wind,window,wipe,wish,with,within,without,woke,woman,women,won't,wonder,wood,word,wore,work,world,worry,worse,would,wouldn't,wow,wrap,write,wrong,yeah,year,yell,yes,yet,you,you'd,you'll,you're,you've,young,your,yourself,TRUE diff --git a/proselint/checks/restricted/top1000.py b/proselint/checks/restricted/top1000.py index e2ac63398..50d7bf4ce 100644 --- a/proselint/checks/restricted/top1000.py +++ b/proselint/checks/restricted/top1000.py @@ -12,1011 +12,21 @@ Top 1000. """ +import csv +try: + from importlib.resources import files +except ImportError: + from importlib_resources import files + +import proselint from proselint.tools import memoize, reverse_existence_check +_CSV_PATH = 'checks/restricted/top1000.csv' +with files(proselint).joinpath(_CSV_PATH).open('r') as data: + reader = csv.reader(data) + wordlist = list(reader).pop() -TOP1000_WORDS = [ - "a", - "able", - "about", - "above", - "accept", - "across", - "act", - "actually", - "add", - "admit", - "afraid", - "after", - "afternoon", - "again", - "against", - "age", - "ago", - "agree", - "ah", - "ahead", - "air", - "all", - "allow", - "almost", - "alone", - "along", - "already", - "alright", - "also", - "although", - "always", - "am", - "amaze", - "an", - "and", - "anger", - "angry", - "animal", - "annoy", - "another", - "answer", - "any", - "anymore", - "anyone", - "anything", - "anyway", - "apartment", - "apparently", - "appear", - "approach", - "are", - "area", - "aren't", - "arm", - "around", - "arrive", - "as", - "ask", - "asleep", - "ass", - "at", - "attack", - "attempt", - "attention", - "aunt", - "avoid", - "away", - "baby", - "back", - "bad", - "bag", - "ball", - "band", - "bar", - "barely", - "bathroom", - "be", - "beat", - "beautiful", - "became", - "because", - "become", - "bed", - "bedroom", - "been", - "before", - "began", - "begin", - "behind", - "believe", - "bell", - "beside", - "besides", - "best", - "better", - "between", - "big", - "bit", - "bite", - "black", - "blink", - "block", - "blonde", - "blood", - "blue", - "blush", - "body", - "book", - "bore", - "both", - "bother", - "bottle", - "bottom", - "box", - "boy", - "boyfriend", - "brain", - "break", - "breakfast", - "breath", - "breathe", - "bright", - "bring", - "broke", - "broken", - "brother", - "brought", - "brown", - "brush", - "build", - "burn", - "burst", - "bus", - "business", - "busy", - "but", - "buy", - "by", - "call", - "calm", - "came", - "can", - "can't", - "car", - "card", - "care", - "carefully", - "carry", - "case", - "cat", - "catch", - "caught", - "cause", - "cell", - "chair", - "chance", - "change", - "chase", - "check", - "cheek", - "chest", - "child", - "children", - "chuckle", - "city", - "class", - "clean", - "clear", - "climb", - "close", - "clothes", - "coffee", - "cold", - "college", - "color", - "come", - "comment", - "complete", - "completely", - "computer", - "concern", - "confuse", - "consider", - "continue", - "control", - "conversation", - "cool", - "corner", - "couch", - "could", - "couldn't", - "counter", - "couple", - "course", - "cover", - "crack", - "crazy", - "cross", - "crowd", - "cry", - "cup", - "cut", - "cute", - "dad", - "damn", - "dance", - "dark", - "date", - "daughter", - "day", - "dead", - "deal", - "dear", - "death", - "decide", - "deep", - "definitely", - "desk", - "did", - "didn't", - "die", - "different", - "dinner", - "direction", - "disappear", - "do", - "doctor", - "does", - "doesn't", - "dog", - "don't", - "done", - "door", - "doubt", - "down", - "drag", - "draw", - "dream", - "dress", - "drink", - "drive", - "drop", - "drove", - "dry", - "during", - "each", - "ear", - "early", - "easily", - "easy", - "eat", - "edge", - "either", - "else", - "empty", - "end", - "enjoy", - "enough", - "enter", - "entire", - "escape", - "especially", - "even", - "evening", - "eventually", - "ever", - "every", - "everyone", - "everything", - "exactly", - "except", - "excite", - "exclaim", - "excuse", - "expect", - "explain", - "expression", - "eye", - "eyebrow", - "face", - "fact", - "fall", - "family", - "far", - "fast", - "father", - "fault", - "favorite", - "fear", - "feel", - "feet", - "fell", - "felt", - "few", - "field", - "fight", - "figure", - "fill", - "finally", - "find", - "fine", - "finger", - "finish", - "fire", - "first", - "fit", - "five", - "fix", - "flash", - "flip", - "floor", - "fly", - "focus", - "follow", - "food", - "foot", - "for", - "force", - "forget", - "form", - "forward", - "found", - "four", - "free", - "friend", - "from", - "front", - "frown", - "fuck", - "full", - "fun", - "funny", - "further", - "game", - "gasp", - "gave", - "gaze", - "gently", - "get", - "giggle", - "girl", - "girlfriend", - "give", - "given", - "glad", - "glance", - "glare", - "glass", - "go", - "God", - "gone", - "gonna", - "good", - "got", - "gotten", - "grab", - "great", - "green", - "greet", - "grey", - "grin", - "grip", - "groan", - "ground", - "group", - "grow", - "guard", - "guess", - "gun", - "guy", - "had", - "hadn't", - "hair", - "half", - "hall", - "hallway", - "hand", - "handle", - "hang", - "happen", - "happy", - "hard", - "has", - "hate", - "have", - "haven't", - "he", - "he'd", - "he's", - "head", - "hear", - "heard", - "heart", - "heavy", - "held", - "hell", - "hello", - "help", - "her", - "here", - "herself", - "hey", - "hi", - "hide", - "high", - "him", - "himself", - "his", - "hit", - "hold", - "home", - "hope", - "horse", - "hospital", - "hot", - "hour", - "house", - "how", - "however", - "hug", - "huge", - "huh", - "human", - "hundred", - "hung", - "hurry", - "hurt", - "I", - "I'd", - "I'll", - "I'm", - "I've", - "ice", - "idea", - "if", - "ignore", - "imagine", - "immediately", - "important", - "in", - "inside", - "instead", - "interest", - "interrupt", - "into", - "is", - "isn't", - "it", - "it's", - "its", - "jacket", - "jeans", - "jerk", - "job", - "join", - "joke", - "jump", - "just", - "keep", - "kept", - "key", - "kick", - "kid", - "kill", - "kind", - "kiss", - "kitchen", - "knee", - "knew", - "knock", - "know", - "known", - "lady", - "land", - "large", - "last", - "late", - "laugh", - "lay", - "lead", - "lean", - "learn", - "least", - "leave", - "led", - "left", - "leg", - "less", - "let", - "letter", - "lie", - "life", - "lift", - "light", - "like", - "line", - "lip", - "listen", - "little", - "live", - "lock", - "locker", - "long", - "look", - "lose", - "lost", - "lot", - "loud", - "love", - "low", - "lunch", - "mad", - "made", - "make", - "man", - "manage", - "many", - "mark", - "marry", - "match", - "matter", - "may", - "maybe", - "me", - "mean", - "meant", - "meet", - "memory", - "men", - "mention", - "met", - "middle", - "might", - "mind", - "mine", - "minute", - "mirror", - "miss", - "mom", - "moment", - "money", - "month", - "mood", - "more", - "morning", - "most", - "mother", - "mouth", - "move", - "movie", - "Mr.", - "Mrs.", - "much", - "mum", - "mumble", - "music", - "must", - "mutter", - "my", - "myself", - "name", - "near", - "nearly", - "neck", - "need", - "nervous", - "never", - "new", - "next", - "nice", - "night", - "no", - "nod", - "noise", - "none", - "normal", - "nose", - "not", - "note", - "nothing", - "notice", - "now", - "number", - "obviously", - "of", - "off", - "offer", - "office", - "often", - "oh", - "okay", - "old", - "on", - "once", - "one", - "only", - "onto", - "open", - "or", - "order", - "other", - "our", - "out", - "outside", - "over", - "own", - "pack", - "pain", - "paint", - "pair", - "pants", - "paper", - "parents", - "park", - "part", - "party", - "pass", - "past", - "pause", - "pay", - "people", - "perfect", - "perhaps", - "person", - "phone", - "pick", - "picture", - "piece", - "pink", - "piss", - "place", - "plan", - "play", - "please", - "pocket", - "point", - "police", - "pop", - "position", - "possible", - "power", - "practically", - "present", - "press", - "pretend", - "pretty", - "probably", - "problem", - "promise", - "pull", - "punch", - "push", - "put", - "question", - "quick", - "quickly", - "quiet", - "quietly", - "quite", - "race", - "rain", - "raise", - "ran", - "rang", - "rather", - "reach", - "read", - "ready", - "real", - "realize", - "really", - "reason", - "recognize", - "red", - "relationship", - "relax", - "remain", - "remember", - "remind", - "repeat", - "reply", - "respond", - "rest", - "return", - "ride", - "right", - "ring", - "road", - "rock", - "roll", - "room", - "rose", - "round", - "rub", - "run", - "rush", - "sad", - "safe", - "said", - "same", - "sat", - "save", - "saw", - "say", - "scare", - "school", - "scream", - "search", - "seat", - "second", - "see", - "seem", - "seen", - "self", - "send", - "sense", - "sent", - "serious", - "seriously", - "set", - "settle", - "seven", - "several", - "shadow", - "shake", - "share", - "she", - "she'd", - "she's", - "shift", - "shirt", - "shit", - "shock", - "shoe", - "shook", - "shop", - "short", - "shot", - "should", - "shoulder", - "shouldn't", - "shout", - "shove", - "show", - "shower", - "shrug", - "shut", - "sick", - "side", - "sigh", - "sight", - "sign", - "silence", - "silent", - "simply", - "since", - "single", - "sir", - "sister", - "sit", - "situation", - "six", - "skin", - "sky", - "slam", - "sleep", - "slightly", - "slip", - "slow", - "slowly", - "small", - "smell", - "smile", - "smirk", - "smoke", - "snap", - "so", - "soft", - "softly", - "some", - "somehow", - "someone", - "something", - "sometimes", - "somewhere", - "son", - "song", - "soon", - "sorry", - "sort", - "sound", - "space", - "speak", - "spend", - "spent", - "spoke", - "spot", - "stair", - "stand", - "star", - "stare", - "start", - "state", - "stay", - "step", - "stick", - "still", - "stomach", - "stood", - "stop", - "store", - "story", - "straight", - "strange", - "street", - "strong", - "struggle", - "stuck", - "student", - "study", - "stuff", - "stupid", - "such", - "suck", - "sudden", - "suddenly", - "suggest", - "summer", - "sun", - "suppose", - "sure", - "surprise", - "surround", - "sweet", - "table", - "take", - "taken", - "talk", - "tall", - "teacher", - "team", - "tear", - "teeth", - "tell", - "ten", - "than", - "thank", - "that", - "that's", - "the", - "their", - "them", - "themselves", - "then", - "there", - "there's", - "these", - "they", - "they'd", - "they're", - "thick", - "thing", - "think", - "third", - "this", - "those", - "though", - "thought", - "three", - "threw", - "throat", - "through", - "throw", - "tie", - "tight", - "time", - "tiny", - "tire", - "to", - "today", - "together", - "told", - "tomorrow", - "tone", - "tongue", - "tonight", - "too", - "took", - "top", - "totally", - "touch", - "toward", - "town", - "track", - "trail", - "train", - "tree", - "trip", - "trouble", - "trust", - "truth", - "try", - "turn", - "TV", - "twenty", - "two", - "type", - "uncle", - "under", - "understand", - "until", - "up", - "upon", - "us", - "use", - "usual", - "usually", - "very", - "visit", - "voice", - "wait", - "wake", - "walk", - "wall", - "want", - "warm", - "warn", - "was", - "wasn't", - "watch", - "water", - "wave", - "way", - "we", - "we'll", - "we're", - "we've", - "wear", - "week", - "weird", - "well", - "went", - "were", - "weren't", - "wet", - "what", - "what's", - "whatever", - "when", - "where", - "whether", - "which", - "while", - "whisper", - "white", - "who", - "whole", - "why", - "wide", - "wife", - "will", - "wind", - "window", - "wipe", - "wish", - "with", - "within", - "without", - "woke", - "woman", - "women", - "won't", - "wonder", - "wood", - "word", - "wore", - "work", - "world", - "worry", - "worse", - "would", - "wouldn't", - "wow", - "wrap", - "write", - "wrong", - "yeah", - "year", - "yell", - "yes", - "yet", - "you", - "you'd", - "you'll", - "you're", - "you've", - "young", - "your", - "yourself", - "TRUE", -] +TOP1000_WORDS = wordlist @memoize diff --git a/pyproject.toml b/pyproject.toml index e1ade3d5a..ff4cc011b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ exclude = ["tests/.gitignore"] [tool.poetry.dependencies] python = "^3.8.1" click = "^8.0.0" +importlib-resources = { version = "^6.0", python = "<3.9" } [tool.poetry.group.dev.dependencies] gmail = { git = "https://github.com/charlierguo/gmail.git" } From 057b52933ebbdb6447ce171ae352b017f2d3a3cb Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Mon, 13 May 2024 14:09:58 -0400 Subject: [PATCH 08/14] Py3.8 balks at type annotation --- proselint/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proselint/tools.py b/proselint/tools.py index 7c5a89f44..f520537d2 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -365,7 +365,7 @@ def existence_check(text, list, err, msg, ignore_case=True, str=False, return errors -def _allowed_word(permitted: set[str], match: re.Match, /, ignore_case=True): +def _allowed_word(permitted, match: re.Match, /, ignore_case=True): """Determine if a match object result is in a set of strings.""" matched = match.string[match.start():match.end()] if ignore_case: From d3266a47e5e7fb6eb75a6cff0b5c6282bb56c29d Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Mon, 13 May 2024 14:29:06 -0400 Subject: [PATCH 09/14] More terse set-conversion code --- proselint/tools.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/proselint/tools.py b/proselint/tools.py index f520537d2..9f13975dc 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -377,10 +377,7 @@ def reverse_existence_check( text, list, err, msg, ignore_case=True, offset=0 ): """Find all words in ``text`` that aren't on the ``list``.""" - if ignore_case: - permitted = set([word.lower() for word in list]) - else: - permitted = set(list) + permitted = set([word.lower() for word in list] if ignore_case else list) allowed_word = functools.partial( _allowed_word, permitted, ignore_case=ignore_case) From 8695911d66e2a438df9acfa4b0ea9b921308f277 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Mon, 13 May 2024 14:55:09 -0400 Subject: [PATCH 10/14] Reformat CSV files to one-word-per-line --- proselint/checks/restricted/elementary.csv | 850 ++++++++++++++++- proselint/checks/restricted/elementary.py | 4 +- proselint/checks/restricted/top1000.csv | 1001 +++++++++++++++++++- proselint/checks/restricted/top1000.json | 1 + proselint/checks/restricted/top1000.py | 5 +- 5 files changed, 1857 insertions(+), 4 deletions(-) create mode 100644 proselint/checks/restricted/top1000.json diff --git a/proselint/checks/restricted/elementary.csv b/proselint/checks/restricted/elementary.csv index e6e3dfc9e..f344611a7 100644 --- a/proselint/checks/restricted/elementary.csv +++ b/proselint/checks/restricted/elementary.csv @@ -1 +1,849 @@ -a,all,am,and,at,ball,be,bed,big,book,box,boy,but,came,can,car,cat,come,cow,dad,day,did,do,dog,fat,for,fun,get,go,good,got,had,hat,he,hen,here,him,his,home,hot,I,if,in,into,is,it,its,let,like,look,man,may,me,mom,my,no,not,of,oh,old,on,one,out,pan,pet,pig,play,ran,rat,red,ride,run,sat,see,she,sit,six,so,stop,sun,ten,the,this,to,top,toy,two,up,us,was,we,will,yes,you,about,add,after,ago,an,any,apple,are,as,ask,ate,away,baby,back,bad,bag,base,bat,bee,been,before,being,best,bike,bill,bird,black,blue,boat,both,bring,brother,brown,bus,buy,by,cake,call,candy,change,child,city,clean,club,coat,cold,coming,corn,could,cry,cup,cut,daddy,dear,deep,deer,doing,doll,door,down,dress,drive,drop,dry,duck,each,eat,eating,egg,end,fall,far,farm,fast,father,feed,feel,feet,fell,find,fine,fire,first,fish,five,fix,flag,floor,fly,food,foot,four,fox,from,full,funny,game,gas,gave,girl,give,glad,goat,goes,going,gold,gone,grade,grass,green,grow,hand,happy,hard,has,have,hear,help,here,hill,hit,hold,hole,hop,hope,horse,house,how,ice,inch,inside,job,jump,just,keep,king,know,lake,land,last,late,lay,left,leg,light,line,little,live,lives,long,looking,lost,lot,love,mad,made,make,many,meat,men,met,mile,milk,mine,miss,moon,more,most,mother,move,much,must,myself,nail,name,need,new,next,nice,night,nine,north,now,nut,off,only,open,or,other,our,outside,over,page,park,part,pay,pick,plant,playing,pony,post,pull,put,rabbit,rain,read,rest,riding,road,rock,room,said,same,sang,saw,say,school,sea,seat,seem,seen,send,set,seven,sheep,ship,shoe,show,sick,side,sing,sky,sleep,small,snow,some,soon,spell,start,stay,still,store,story,take,talk,tall,teach,tell,than,thank,that,them,then,there,they,thing,think,three,time,today,told,too,took,train,tree,truck,try,use,very,walk,want,warm,wash,way,week,well,went,were,wet,what,when,while,white,who,why,wind,wish,with,woke,wood,work,yellow,yet,your,zoo,able,above,afraid,afternoon,again,age,air,airplane,almost,alone,along,already,also,always,animal,another,anything,around,art,aunt,balloon,bark,barn,basket,beach,bear,because,become,began,begin,behind,believe,below,belt,better,birthday,body,bones,born,bought,bread,bright,broke,brought,busy,cabin,cage,camp,can't,care,carry,catch,cattle,cave,children,class,close,cloth,coal,color,corner,cotton,cover,dark,desert,didn't,dinner,dishes,does,done,don't,dragon,draw,dream,drink,early,earth,east,eight,even,ever,every,everyone,everything,eyes,face,family,feeling,felt,few,fight,fishing,flower,flying,follow,forest,forgot,form,found,fourth,free,Friday,friend,front,getting,given,grandmother,great,grew,ground,guess,hair,half,having,head,heard,he's,heat,hello,high,himself,hour,hundred,hurry,hurt,I'd,I'll,I'm,inches,isn't,it's,I've,kept,kids,kind,kitten,knew,knife,lady,large,largest,later,learn,leave,let's,letter,life,list,living,lovely,loving,lunch,mail,making,maybe,mean,merry,might,mind,money,month,morning,mouse,mouth,Mr.,Mrs.,Ms.,music,near,nearly,never,news,noise,nothing,number,o'clock,often,oil,once,orange,order,own,pair,paint,paper,party,pass,past,penny,people,person,picture,place,plan,plane,please,pocket,point,poor,race,reach,reading,ready,real,rich,right,river,rocket,rode,round,rule,running,salt,says,sending,sent,seventh,sew,shall,short,shot,should,sight,sister,sitting,sixth,sled,smoke,soap,someone,something,sometime,song,sorry,sound,south,space,spelling,spent,sport,spring,stairs,stand,state,step,stick,stood,stopped,stove,street,strong,study,such,sugar,summer,Sunday,supper,table,taken,taking,talking,teacher,team,teeth,tenth,that's,their,these,thinking,third,those,thought,throw,tonight,trade,trick,trip,trying,turn,twelve,twenty,uncle,under,upon,wagon,wait,walking,wasn't,watch,water,weather,we're,west,wheat,where,which,wife,wild,win,window,winter,without,woman,won,won't,wool,word,working,world,would,write,wrong,yard,year,yesterday,you're,across,against,answer,awhile,between,board,bottom,breakfast,broken,build,building,built,captain,carried,caught,charge,chicken,circus,cities,clothes,company,couldn't,country,discover,doctor,doesn't,dollar,during,eighth,else,enjoy,enough,everybody,example,except,excuse,field,fifth,finish,following,good-by,group,happened,harden,haven't,heavy,held,hospital,idea,instead,known,laugh,middle,minute,mountain,ninth,ocean,office,parent,peanut,pencil,picnic,police,pretty,prize,quite,radio,raise,really,reason,remember,return,Saturday,scare,second,since,slowly,stories,student,sudden,suit,sure,swimming,though,threw,tired,together,tomorrow,toward,tried,trouble,truly,turtle,until,village,visit,wear,we'll,whole,whose,women,wouldn't,writing,written,wrote,yell,young,although,America,among,arrive,attention,beautiful,countries,course,cousin,decide,different,evening,favorite,finally,future,happiest,happiness,important,interest,piece,planet,present,president,principal,probably,problem,receive,sentence,several,special,suddenly,suppose,surely,surprise,they're,through,usually +a +all +am +and +at +ball +be +bed +big +book +box +boy +but +came +can +car +cat +come +cow +dad +day +did +do +dog +fat +for +fun +get +go +good +got +had +hat +he +hen +here +him +his +home +hot +I +if +in +into +is +it +its +let +like +look +man +may +me +mom +my +no +not +of +oh +old +on +one +out +pan +pet +pig +play +ran +rat +red +ride +run +sat +see +she +sit +six +so +stop +sun +ten +the +this +to +top +toy +two +up +us +was +we +will +yes +you +about +add +after +ago +an +any +apple +are +as +ask +ate +away +baby +back +bad +bag +base +bat +bee +been +before +being +best +bike +bill +bird +black +blue +boat +both +bring +brother +brown +bus +buy +by +cake +call +candy +change +child +city +clean +club +coat +cold +coming +corn +could +cry +cup +cut +daddy +dear +deep +deer +doing +doll +door +down +dress +drive +drop +dry +duck +each +eat +eating +egg +end +fall +far +farm +fast +father +feed +feel +feet +fell +find +fine +fire +first +fish +five +fix +flag +floor +fly +food +foot +four +fox +from +full +funny +game +gas +gave +girl +give +glad +goat +goes +going +gold +gone +grade +grass +green +grow +hand +happy +hard +has +have +hear +help +here +hill +hit +hold +hole +hop +hope +horse +house +how +ice +inch +inside +job +jump +just +keep +king +know +lake +land +last +late +lay +left +leg +light +line +little +live +lives +long +looking +lost +lot +love +mad +made +make +many +meat +men +met +mile +milk +mine +miss +moon +more +most +mother +move +much +must +myself +nail +name +need +new +next +nice +night +nine +north +now +nut +off +only +open +or +other +our +outside +over +page +park +part +pay +pick +plant +playing +pony +post +pull +put +rabbit +rain +read +rest +riding +road +rock +room +said +same +sang +saw +say +school +sea +seat +seem +seen +send +set +seven +sheep +ship +shoe +show +sick +side +sing +sky +sleep +small +snow +some +soon +spell +start +stay +still +store +story +take +talk +tall +teach +tell +than +thank +that +them +then +there +they +thing +think +three +time +today +told +too +took +train +tree +truck +try +use +very +walk +want +warm +wash +way +week +well +went +were +wet +what +when +while +white +who +why +wind +wish +with +woke +wood +work +yellow +yet +your +zoo +able +above +afraid +afternoon +again +age +air +airplane +almost +alone +along +already +also +always +animal +another +anything +around +art +aunt +balloon +bark +barn +basket +beach +bear +because +become +began +begin +behind +believe +below +belt +better +birthday +body +bones +born +bought +bread +bright +broke +brought +busy +cabin +cage +camp +can't +care +carry +catch +cattle +cave +children +class +close +cloth +coal +color +corner +cotton +cover +dark +desert +didn't +dinner +dishes +does +done +don't +dragon +draw +dream +drink +early +earth +east +eight +even +ever +every +everyone +everything +eyes +face +family +feeling +felt +few +fight +fishing +flower +flying +follow +forest +forgot +form +found +fourth +free +Friday +friend +front +getting +given +grandmother +great +grew +ground +guess +hair +half +having +head +heard +he's +heat +hello +high +himself +hour +hundred +hurry +hurt +I'd +I'll +I'm +inches +isn't +it's +I've +kept +kids +kind +kitten +knew +knife +lady +large +largest +later +learn +leave +let's +letter +life +list +living +lovely +loving +lunch +mail +making +maybe +mean +merry +might +mind +money +month +morning +mouse +mouth +Mr. +Mrs. +Ms. +music +near +nearly +never +news +noise +nothing +number +o'clock +often +oil +once +orange +order +own +pair +paint +paper +party +pass +past +penny +people +person +picture +place +plan +plane +please +pocket +point +poor +race +reach +reading +ready +real +rich +right +river +rocket +rode +round +rule +running +salt +says +sending +sent +seventh +sew +shall +short +shot +should +sight +sister +sitting +sixth +sled +smoke +soap +someone +something +sometime +song +sorry +sound +south +space +spelling +spent +sport +spring +stairs +stand +state +step +stick +stood +stopped +stove +street +strong +study +such +sugar +summer +Sunday +supper +table +taken +taking +talking +teacher +team +teeth +tenth +that's +their +these +thinking +third +those +thought +throw +tonight +trade +trick +trip +trying +turn +twelve +twenty +uncle +under +upon +wagon +wait +walking +wasn't +watch +water +weather +we're +west +wheat +where +which +wife +wild +win +window +winter +without +woman +won +won't +wool +word +working +world +would +write +wrong +yard +year +yesterday +you're +across +against +answer +awhile +between +board +bottom +breakfast +broken +build +building +built +captain +carried +caught +charge +chicken +circus +cities +clothes +company +couldn't +country +discover +doctor +doesn't +dollar +during +eighth +else +enjoy +enough +everybody +example +except +excuse +field +fifth +finish +following +good-by +group +happened +harden +haven't +heavy +held +hospital +idea +instead +known +laugh +middle +minute +mountain +ninth +ocean +office +parent +peanut +pencil +picnic +police +pretty +prize +quite +radio +raise +really +reason +remember +return +Saturday +scare +second +since +slowly +stories +student +sudden +suit +sure +swimming +though +threw +tired +together +tomorrow +toward +tried +trouble +truly +turtle +until +village +visit +wear +we'll +whole +whose +women +wouldn't +writing +written +wrote +yell +young +although +America +among +arrive +attention +beautiful +countries +course +cousin +decide +different +evening +favorite +finally +future +happiest +happiness +important +interest +piece +planet +present +president +principal +probably +problem +receive +sentence +several +special +suddenly +suppose +surely +surprise +they're +through +usually diff --git a/proselint/checks/restricted/elementary.py b/proselint/checks/restricted/elementary.py index 8170f53fd..91cdd4a0d 100644 --- a/proselint/checks/restricted/elementary.py +++ b/proselint/checks/restricted/elementary.py @@ -24,7 +24,9 @@ _CSV_PATH = 'checks/restricted/elementary.csv' with files(proselint).joinpath(_CSV_PATH).open('r') as data: reader = csv.reader(data) - wordlist = list(reader).pop() + wordlist = list() + for row in reader: + wordlist.extend(row) ELEMENTARY_WORDS = wordlist diff --git a/proselint/checks/restricted/top1000.csv b/proselint/checks/restricted/top1000.csv index 4a73cfa8e..470aab9b5 100644 --- a/proselint/checks/restricted/top1000.csv +++ b/proselint/checks/restricted/top1000.csv @@ -1 +1,1000 @@ -a,able,about,above,accept,across,act,actually,add,admit,afraid,after,afternoon,again,against,age,ago,agree,ah,ahead,air,all,allow,almost,alone,along,already,alright,also,although,always,am,amaze,an,and,anger,angry,animal,annoy,another,answer,any,anymore,anyone,anything,anyway,apartment,apparently,appear,approach,are,area,aren't,arm,around,arrive,as,ask,asleep,ass,at,attack,attempt,attention,aunt,avoid,away,baby,back,bad,bag,ball,band,bar,barely,bathroom,be,beat,beautiful,became,because,become,bed,bedroom,been,before,began,begin,behind,believe,bell,beside,besides,best,better,between,big,bit,bite,black,blink,block,blonde,blood,blue,blush,body,book,bore,both,bother,bottle,bottom,box,boy,boyfriend,brain,break,breakfast,breath,breathe,bright,bring,broke,broken,brother,brought,brown,brush,build,burn,burst,bus,business,busy,but,buy,by,call,calm,came,can,can't,car,card,care,carefully,carry,case,cat,catch,caught,cause,cell,chair,chance,change,chase,check,cheek,chest,child,children,chuckle,city,class,clean,clear,climb,close,clothes,coffee,cold,college,color,come,comment,complete,completely,computer,concern,confuse,consider,continue,control,conversation,cool,corner,couch,could,couldn't,counter,couple,course,cover,crack,crazy,cross,crowd,cry,cup,cut,cute,dad,damn,dance,dark,date,daughter,day,dead,deal,dear,death,decide,deep,definitely,desk,did,didn't,die,different,dinner,direction,disappear,do,doctor,does,doesn't,dog,don't,done,door,doubt,down,drag,draw,dream,dress,drink,drive,drop,drove,dry,during,each,ear,early,easily,easy,eat,edge,either,else,empty,end,enjoy,enough,enter,entire,escape,especially,even,evening,eventually,ever,every,everyone,everything,exactly,except,excite,exclaim,excuse,expect,explain,expression,eye,eyebrow,face,fact,fall,family,far,fast,father,fault,favorite,fear,feel,feet,fell,felt,few,field,fight,figure,fill,finally,find,fine,finger,finish,fire,first,fit,five,fix,flash,flip,floor,fly,focus,follow,food,foot,for,force,forget,form,forward,found,four,free,friend,from,front,frown,fuck,full,fun,funny,further,game,gasp,gave,gaze,gently,get,giggle,girl,girlfriend,give,given,glad,glance,glare,glass,go,God,gone,gonna,good,got,gotten,grab,great,green,greet,grey,grin,grip,groan,ground,group,grow,guard,guess,gun,guy,had,hadn't,hair,half,hall,hallway,hand,handle,hang,happen,happy,hard,has,hate,have,haven't,he,he'd,he's,head,hear,heard,heart,heavy,held,hell,hello,help,her,here,herself,hey,hi,hide,high,him,himself,his,hit,hold,home,hope,horse,hospital,hot,hour,house,how,however,hug,huge,huh,human,hundred,hung,hurry,hurt,I,I'd,I'll,I'm,I've,ice,idea,if,ignore,imagine,immediately,important,in,inside,instead,interest,interrupt,into,is,isn't,it,it's,its,jacket,jeans,jerk,job,join,joke,jump,just,keep,kept,key,kick,kid,kill,kind,kiss,kitchen,knee,knew,knock,know,known,lady,land,large,last,late,laugh,lay,lead,lean,learn,least,leave,led,left,leg,less,let,letter,lie,life,lift,light,like,line,lip,listen,little,live,lock,locker,long,look,lose,lost,lot,loud,love,low,lunch,mad,made,make,man,manage,many,mark,marry,match,matter,may,maybe,me,mean,meant,meet,memory,men,mention,met,middle,might,mind,mine,minute,mirror,miss,mom,moment,money,month,mood,more,morning,most,mother,mouth,move,movie,Mr.,Mrs.,much,mum,mumble,music,must,mutter,my,myself,name,near,nearly,neck,need,nervous,never,new,next,nice,night,no,nod,noise,none,normal,nose,not,note,nothing,notice,now,number,obviously,of,off,offer,office,often,oh,okay,old,on,once,one,only,onto,open,or,order,other,our,out,outside,over,own,pack,pain,paint,pair,pants,paper,parents,park,part,party,pass,past,pause,pay,people,perfect,perhaps,person,phone,pick,picture,piece,pink,piss,place,plan,play,please,pocket,point,police,pop,position,possible,power,practically,present,press,pretend,pretty,probably,problem,promise,pull,punch,push,put,question,quick,quickly,quiet,quietly,quite,race,rain,raise,ran,rang,rather,reach,read,ready,real,realize,really,reason,recognize,red,relationship,relax,remain,remember,remind,repeat,reply,respond,rest,return,ride,right,ring,road,rock,roll,room,rose,round,rub,run,rush,sad,safe,said,same,sat,save,saw,say,scare,school,scream,search,seat,second,see,seem,seen,self,send,sense,sent,serious,seriously,set,settle,seven,several,shadow,shake,share,she,she'd,she's,shift,shirt,shit,shock,shoe,shook,shop,short,shot,should,shoulder,shouldn't,shout,shove,show,shower,shrug,shut,sick,side,sigh,sight,sign,silence,silent,simply,since,single,sir,sister,sit,situation,six,skin,sky,slam,sleep,slightly,slip,slow,slowly,small,smell,smile,smirk,smoke,snap,so,soft,softly,some,somehow,someone,something,sometimes,somewhere,son,song,soon,sorry,sort,sound,space,speak,spend,spent,spoke,spot,stair,stand,star,stare,start,state,stay,step,stick,still,stomach,stood,stop,store,story,straight,strange,street,strong,struggle,stuck,student,study,stuff,stupid,such,suck,sudden,suddenly,suggest,summer,sun,suppose,sure,surprise,surround,sweet,table,take,taken,talk,tall,teacher,team,tear,teeth,tell,ten,than,thank,that,that's,the,their,them,themselves,then,there,there's,these,they,they'd,they're,thick,thing,think,third,this,those,though,thought,three,threw,throat,through,throw,tie,tight,time,tiny,tire,to,today,together,told,tomorrow,tone,tongue,tonight,too,took,top,totally,touch,toward,town,track,trail,train,tree,trip,trouble,trust,truth,try,turn,TV,twenty,two,type,uncle,under,understand,until,up,upon,us,use,usual,usually,very,visit,voice,wait,wake,walk,wall,want,warm,warn,was,wasn't,watch,water,wave,way,we,we'll,we're,we've,wear,week,weird,well,went,were,weren't,wet,what,what's,whatever,when,where,whether,which,while,whisper,white,who,whole,why,wide,wife,will,wind,window,wipe,wish,with,within,without,woke,woman,women,won't,wonder,wood,word,wore,work,world,worry,worse,would,wouldn't,wow,wrap,write,wrong,yeah,year,yell,yes,yet,you,you'd,you'll,you're,you've,young,your,yourself,TRUE +a +able +about +above +accept +across +act +actually +add +admit +afraid +after +afternoon +again +against +age +ago +agree +ah +ahead +air +all +allow +almost +alone +along +already +alright +also +although +always +am +amaze +an +and +anger +angry +animal +annoy +another +answer +any +anymore +anyone +anything +anyway +apartment +apparently +appear +approach +are +area +aren't +arm +around +arrive +as +ask +asleep +ass +at +attack +attempt +attention +aunt +avoid +away +baby +back +bad +bag +ball +band +bar +barely +bathroom +be +beat +beautiful +became +because +become +bed +bedroom +been +before +began +begin +behind +believe +bell +beside +besides +best +better +between +big +bit +bite +black +blink +block +blonde +blood +blue +blush +body +book +bore +both +bother +bottle +bottom +box +boy +boyfriend +brain +break +breakfast +breath +breathe +bright +bring +broke +broken +brother +brought +brown +brush +build +burn +burst +bus +business +busy +but +buy +by +call +calm +came +can +can't +car +card +care +carefully +carry +case +cat +catch +caught +cause +cell +chair +chance +change +chase +check +cheek +chest +child +children +chuckle +city +class +clean +clear +climb +close +clothes +coffee +cold +college +color +come +comment +complete +completely +computer +concern +confuse +consider +continue +control +conversation +cool +corner +couch +could +couldn't +counter +couple +course +cover +crack +crazy +cross +crowd +cry +cup +cut +cute +dad +damn +dance +dark +date +daughter +day +dead +deal +dear +death +decide +deep +definitely +desk +did +didn't +die +different +dinner +direction +disappear +do +doctor +does +doesn't +dog +don't +done +door +doubt +down +drag +draw +dream +dress +drink +drive +drop +drove +dry +during +each +ear +early +easily +easy +eat +edge +either +else +empty +end +enjoy +enough +enter +entire +escape +especially +even +evening +eventually +ever +every +everyone +everything +exactly +except +excite +exclaim +excuse +expect +explain +expression +eye +eyebrow +face +fact +fall +family +far +fast +father +fault +favorite +fear +feel +feet +fell +felt +few +field +fight +figure +fill +finally +find +fine +finger +finish +fire +first +fit +five +fix +flash +flip +floor +fly +focus +follow +food +foot +for +force +forget +form +forward +found +four +free +friend +from +front +frown +fuck +full +fun +funny +further +game +gasp +gave +gaze +gently +get +giggle +girl +girlfriend +give +given +glad +glance +glare +glass +go +God +gone +gonna +good +got +gotten +grab +great +green +greet +grey +grin +grip +groan +ground +group +grow +guard +guess +gun +guy +had +hadn't +hair +half +hall +hallway +hand +handle +hang +happen +happy +hard +has +hate +have +haven't +he +he'd +he's +head +hear +heard +heart +heavy +held +hell +hello +help +her +here +herself +hey +hi +hide +high +him +himself +his +hit +hold +home +hope +horse +hospital +hot +hour +house +how +however +hug +huge +huh +human +hundred +hung +hurry +hurt +I +I'd +I'll +I'm +I've +ice +idea +if +ignore +imagine +immediately +important +in +inside +instead +interest +interrupt +into +is +isn't +it +it's +its +jacket +jeans +jerk +job +join +joke +jump +just +keep +kept +key +kick +kid +kill +kind +kiss +kitchen +knee +knew +knock +know +known +lady +land +large +last +late +laugh +lay +lead +lean +learn +least +leave +led +left +leg +less +let +letter +lie +life +lift +light +like +line +lip +listen +little +live +lock +locker +long +look +lose +lost +lot +loud +love +low +lunch +mad +made +make +man +manage +many +mark +marry +match +matter +may +maybe +me +mean +meant +meet +memory +men +mention +met +middle +might +mind +mine +minute +mirror +miss +mom +moment +money +month +mood +more +morning +most +mother +mouth +move +movie +Mr. +Mrs. +much +mum +mumble +music +must +mutter +my +myself +name +near +nearly +neck +need +nervous +never +new +next +nice +night +no +nod +noise +none +normal +nose +not +note +nothing +notice +now +number +obviously +of +off +offer +office +often +oh +okay +old +on +once +one +only +onto +open +or +order +other +our +out +outside +over +own +pack +pain +paint +pair +pants +paper +parents +park +part +party +pass +past +pause +pay +people +perfect +perhaps +person +phone +pick +picture +piece +pink +piss +place +plan +play +please +pocket +point +police +pop +position +possible +power +practically +present +press +pretend +pretty +probably +problem +promise +pull +punch +push +put +question +quick +quickly +quiet +quietly +quite +race +rain +raise +ran +rang +rather +reach +read +ready +real +realize +really +reason +recognize +red +relationship +relax +remain +remember +remind +repeat +reply +respond +rest +return +ride +right +ring +road +rock +roll +room +rose +round +rub +run +rush +sad +safe +said +same +sat +save +saw +say +scare +school +scream +search +seat +second +see +seem +seen +self +send +sense +sent +serious +seriously +set +settle +seven +several +shadow +shake +share +she +she'd +she's +shift +shirt +shit +shock +shoe +shook +shop +short +shot +should +shoulder +shouldn't +shout +shove +show +shower +shrug +shut +sick +side +sigh +sight +sign +silence +silent +simply +since +single +sir +sister +sit +situation +six +skin +sky +slam +sleep +slightly +slip +slow +slowly +small +smell +smile +smirk +smoke +snap +so +soft +softly +some +somehow +someone +something +sometimes +somewhere +son +song +soon +sorry +sort +sound +space +speak +spend +spent +spoke +spot +stair +stand +star +stare +start +state +stay +step +stick +still +stomach +stood +stop +store +story +straight +strange +street +strong +struggle +stuck +student +study +stuff +stupid +such +suck +sudden +suddenly +suggest +summer +sun +suppose +sure +surprise +surround +sweet +table +take +taken +talk +tall +teacher +team +tear +teeth +tell +ten +than +thank +that +that's +the +their +them +themselves +then +there +there's +these +they +they'd +they're +thick +thing +think +third +this +those +though +thought +three +threw +throat +through +throw +tie +tight +time +tiny +tire +to +today +together +told +tomorrow +tone +tongue +tonight +too +took +top +totally +touch +toward +town +track +trail +train +tree +trip +trouble +trust +truth +try +turn +TV +twenty +two +type +uncle +under +understand +until +up +upon +us +use +usual +usually +very +visit +voice +wait +wake +walk +wall +want +warm +warn +was +wasn't +watch +water +wave +way +we +we'll +we're +we've +wear +week +weird +well +went +were +weren't +wet +what +what's +whatever +when +where +whether +which +while +whisper +white +who +whole +why +wide +wife +will +wind +window +wipe +wish +with +within +without +woke +woman +women +won't +wonder +wood +word +wore +work +world +worry +worse +would +wouldn't +wow +wrap +write +wrong +yeah +year +yell +yes +yet +you +you'd +you'll +you're +you've +young +your +yourself +TRUE diff --git a/proselint/checks/restricted/top1000.json b/proselint/checks/restricted/top1000.json new file mode 100644 index 000000000..958cdeba8 --- /dev/null +++ b/proselint/checks/restricted/top1000.json @@ -0,0 +1 @@ +["a", "able", "about", "above", "accept", "across", "act", "actually", "add", "admit", "afraid", "after", "afternoon", "again", "against", "age", "ago", "agree", "ah", "ahead", "air", "all", "allow", "almost", "alone", "along", "already", "alright", "also", "although", "always", "am", "amaze", "an", "and", "anger", "angry", "animal", "annoy", "another", "answer", "any", "anymore", "anyone", "anything", "anyway", "apartment", "apparently", "appear", "approach", "are", "area", "aren't", "arm", "around", "arrive", "as", "ask", "asleep", "ass", "at", "attack", "attempt", "attention", "aunt", "avoid", "away", "baby", "back", "bad", "bag", "ball", "band", "bar", "barely", "bathroom", "be", "beat", "beautiful", "became", "because", "become", "bed", "bedroom", "been", "before", "began", "begin", "behind", "believe", "bell", "beside", "besides", "best", "better", "between", "big", "bit", "bite", "black", "blink", "block", "blonde", "blood", "blue", "blush", "body", "book", "bore", "both", "bother", "bottle", "bottom", "box", "boy", "boyfriend", "brain", "break", "breakfast", "breath", "breathe", "bright", "bring", "broke", "broken", "brother", "brought", "brown", "brush", "build", "burn", "burst", "bus", "business", "busy", "but", "buy", "by", "call", "calm", "came", "can", "can't", "car", "card", "care", "carefully", "carry", "case", "cat", "catch", "caught", "cause", "cell", "chair", "chance", "change", "chase", "check", "cheek", "chest", "child", "children", "chuckle", "city", "class", "clean", "clear", "climb", "close", "clothes", "coffee", "cold", "college", "color", "come", "comment", "complete", "completely", "computer", "concern", "confuse", "consider", "continue", "control", "conversation", "cool", "corner", "couch", "could", "couldn't", "counter", "couple", "course", "cover", "crack", "crazy", "cross", "crowd", "cry", "cup", "cut", "cute", "dad", "damn", "dance", "dark", "date", "daughter", "day", "dead", "deal", "dear", "death", "decide", "deep", "definitely", "desk", "did", "didn't", "die", "different", "dinner", "direction", "disappear", "do", "doctor", "does", "doesn't", "dog", "don't", "done", "door", "doubt", "down", "drag", "draw", "dream", "dress", "drink", "drive", "drop", "drove", "dry", "during", "each", "ear", "early", "easily", "easy", "eat", "edge", "either", "else", "empty", "end", "enjoy", "enough", "enter", "entire", "escape", "especially", "even", "evening", "eventually", "ever", "every", "everyone", "everything", "exactly", "except", "excite", "exclaim", "excuse", "expect", "explain", "expression", "eye", "eyebrow", "face", "fact", "fall", "family", "far", "fast", "father", "fault", "favorite", "fear", "feel", "feet", "fell", "felt", "few", "field", "fight", "figure", "fill", "finally", "find", "fine", "finger", "finish", "fire", "first", "fit", "five", "fix", "flash", "flip", "floor", "fly", "focus", "follow", "food", "foot", "for", "force", "forget", "form", "forward", "found", "four", "free", "friend", "from", "front", "frown", "fuck", "full", "fun", "funny", "further", "game", "gasp", "gave", "gaze", "gently", "get", "giggle", "girl", "girlfriend", "give", "given", "glad", "glance", "glare", "glass", "go", "God", "gone", "gonna", "good", "got", "gotten", "grab", "great", "green", "greet", "grey", "grin", "grip", "groan", "ground", "group", "grow", "guard", "guess", "gun", "guy", "had", "hadn't", "hair", "half", "hall", "hallway", "hand", "handle", "hang", "happen", "happy", "hard", "has", "hate", "have", "haven't", "he", "he'd", "he's", "head", "hear", "heard", "heart", "heavy", "held", "hell", "hello", "help", "her", "here", "herself", "hey", "hi", "hide", "high", "him", "himself", "his", "hit", "hold", "home", "hope", "horse", "hospital", "hot", "hour", "house", "how", "however", "hug", "huge", "huh", "human", "hundred", "hung", "hurry", "hurt", "I", "I'd", "I'll", "I'm", "I've", "ice", "idea", "if", "ignore", "imagine", "immediately", "important", "in", "inside", "instead", "interest", "interrupt", "into", "is", "isn't", "it", "it's", "its", "jacket", "jeans", "jerk", "job", "join", "joke", "jump", "just", "keep", "kept", "key", "kick", "kid", "kill", "kind", "kiss", "kitchen", "knee", "knew", "knock", "know", "known", "lady", "land", "large", "last", "late", "laugh", "lay", "lead", "lean", "learn", "least", "leave", "led", "left", "leg", "less", "let", "letter", "lie", "life", "lift", "light", "like", "line", "lip", "listen", "little", "live", "lock", "locker", "long", "look", "lose", "lost", "lot", "loud", "love", "low", "lunch", "mad", "made", "make", "man", "manage", "many", "mark", "marry", "match", "matter", "may", "maybe", "me", "mean", "meant", "meet", "memory", "men", "mention", "met", "middle", "might", "mind", "mine", "minute", "mirror", "miss", "mom", "moment", "money", "month", "mood", "more", "morning", "most", "mother", "mouth", "move", "movie", "Mr.", "Mrs.", "much", "mum", "mumble", "music", "must", "mutter", "my", "myself", "name", "near", "nearly", "neck", "need", "nervous", "never", "new", "next", "nice", "night", "no", "nod", "noise", "none", "normal", "nose", "not", "note", "nothing", "notice", "now", "number", "obviously", "of", "off", "offer", "office", "often", "oh", "okay", "old", "on", "once", "one", "only", "onto", "open", "or", "order", "other", "our", "out", "outside", "over", "own", "pack", "pain", "paint", "pair", "pants", "paper", "parents", "park", "part", "party", "pass", "past", "pause", "pay", "people", "perfect", "perhaps", "person", "phone", "pick", "picture", "piece", "pink", "piss", "place", "plan", "play", "please", "pocket", "point", "police", "pop", "position", "possible", "power", "practically", "present", "press", "pretend", "pretty", "probably", "problem", "promise", "pull", "punch", "push", "put", "question", "quick", "quickly", "quiet", "quietly", "quite", "race", "rain", "raise", "ran", "rang", "rather", "reach", "read", "ready", "real", "realize", "really", "reason", "recognize", "red", "relationship", "relax", "remain", "remember", "remind", "repeat", "reply", "respond", "rest", "return", "ride", "right", "ring", "road", "rock", "roll", "room", "rose", "round", "rub", "run", "rush", "sad", "safe", "said", "same", "sat", "save", "saw", "say", "scare", "school", "scream", "search", "seat", "second", "see", "seem", "seen", "self", "send", "sense", "sent", "serious", "seriously", "set", "settle", "seven", "several", "shadow", "shake", "share", "she", "she'd", "she's", "shift", "shirt", "shit", "shock", "shoe", "shook", "shop", "short", "shot", "should", "shoulder", "shouldn't", "shout", "shove", "show", "shower", "shrug", "shut", "sick", "side", "sigh", "sight", "sign", "silence", "silent", "simply", "since", "single", "sir", "sister", "sit", "situation", "six", "skin", "sky", "slam", "sleep", "slightly", "slip", "slow", "slowly", "small", "smell", "smile", "smirk", "smoke", "snap", "so", "soft", "softly", "some", "somehow", "someone", "something", "sometimes", "somewhere", "son", "song", "soon", "sorry", "sort", "sound", "space", "speak", "spend", "spent", "spoke", "spot", "stair", "stand", "star", "stare", "start", "state", "stay", "step", "stick", "still", "stomach", "stood", "stop", "store", "story", "straight", "strange", "street", "strong", "struggle", "stuck", "student", "study", "stuff", "stupid", "such", "suck", "sudden", "suddenly", "suggest", "summer", "sun", "suppose", "sure", "surprise", "surround", "sweet", "table", "take", "taken", "talk", "tall", "teacher", "team", "tear", "teeth", "tell", "ten", "than", "thank", "that", "that's", "the", "their", "them", "themselves", "then", "there", "there's", "these", "they", "they'd", "they're", "thick", "thing", "think", "third", "this", "those", "though", "thought", "three", "threw", "throat", "through", "throw", "tie", "tight", "time", "tiny", "tire", "to", "today", "together", "told", "tomorrow", "tone", "tongue", "tonight", "too", "took", "top", "totally", "touch", "toward", "town", "track", "trail", "train", "tree", "trip", "trouble", "trust", "truth", "try", "turn", "TV", "twenty", "two", "type", "uncle", "under", "understand", "until", "up", "upon", "us", "use", "usual", "usually", "very", "visit", "voice", "wait", "wake", "walk", "wall", "want", "warm", "warn", "was", "wasn't", "watch", "water", "wave", "way", "we", "we'll", "we're", "we've", "wear", "week", "weird", "well", "went", "were", "weren't", "wet", "what", "what's", "whatever", "when", "where", "whether", "which", "while", "whisper", "white", "who", "whole", "why", "wide", "wife", "will", "wind", "window", "wipe", "wish", "with", "within", "without", "woke", "woman", "women", "won't", "wonder", "wood", "word", "wore", "work", "world", "worry", "worse", "would", "wouldn't", "wow", "wrap", "write", "wrong", "yeah", "year", "yell", "yes", "yet", "you", "you'd", "you'll", "you're", "you've", "young", "your", "yourself", "TRUE"] \ No newline at end of file diff --git a/proselint/checks/restricted/top1000.py b/proselint/checks/restricted/top1000.py index 50d7bf4ce..0cbde7f99 100644 --- a/proselint/checks/restricted/top1000.py +++ b/proselint/checks/restricted/top1000.py @@ -22,9 +22,12 @@ from proselint.tools import memoize, reverse_existence_check _CSV_PATH = 'checks/restricted/top1000.csv' + with files(proselint).joinpath(_CSV_PATH).open('r') as data: reader = csv.reader(data) - wordlist = list(reader).pop() + wordlist = list() + for row in reader: + wordlist.extend(row) TOP1000_WORDS = wordlist From 51c07161d2dedd7d2c5ef30a9c490b10515a843b Mon Sep 17 00:00:00 2001 From: Nytelife26 Date: Mon, 13 May 2024 20:56:14 +0100 Subject: [PATCH 11/14] chore: crlf -> lf --- proselint/checks/restricted/elementary.csv | 3 ++- proselint/checks/restricted/top1000.csv | 3 ++- proselint/checks/restricted/top1000.json | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) delete mode 100644 proselint/checks/restricted/top1000.json diff --git a/proselint/checks/restricted/elementary.csv b/proselint/checks/restricted/elementary.csv index f344611a7..e28fb67f4 100644 --- a/proselint/checks/restricted/elementary.csv +++ b/proselint/checks/restricted/elementary.csv @@ -846,4 +846,5 @@ surely surprise they're through -usually +usually + diff --git a/proselint/checks/restricted/top1000.csv b/proselint/checks/restricted/top1000.csv index 470aab9b5..5d903d9f6 100644 --- a/proselint/checks/restricted/top1000.csv +++ b/proselint/checks/restricted/top1000.csv @@ -997,4 +997,5 @@ you've young your yourself -TRUE +TRUE + diff --git a/proselint/checks/restricted/top1000.json b/proselint/checks/restricted/top1000.json deleted file mode 100644 index 958cdeba8..000000000 --- a/proselint/checks/restricted/top1000.json +++ /dev/null @@ -1 +0,0 @@ -["a", "able", "about", "above", "accept", "across", "act", "actually", "add", "admit", "afraid", "after", "afternoon", "again", "against", "age", "ago", "agree", "ah", "ahead", "air", "all", "allow", "almost", "alone", "along", "already", "alright", "also", "although", "always", "am", "amaze", "an", "and", "anger", "angry", "animal", "annoy", "another", "answer", "any", "anymore", "anyone", "anything", "anyway", "apartment", "apparently", "appear", "approach", "are", "area", "aren't", "arm", "around", "arrive", "as", "ask", "asleep", "ass", "at", "attack", "attempt", "attention", "aunt", "avoid", "away", "baby", "back", "bad", "bag", "ball", "band", "bar", "barely", "bathroom", "be", "beat", "beautiful", "became", "because", "become", "bed", "bedroom", "been", "before", "began", "begin", "behind", "believe", "bell", "beside", "besides", "best", "better", "between", "big", "bit", "bite", "black", "blink", "block", "blonde", "blood", "blue", "blush", "body", "book", "bore", "both", "bother", "bottle", "bottom", "box", "boy", "boyfriend", "brain", "break", "breakfast", "breath", "breathe", "bright", "bring", "broke", "broken", "brother", "brought", "brown", "brush", "build", "burn", "burst", "bus", "business", "busy", "but", "buy", "by", "call", "calm", "came", "can", "can't", "car", "card", "care", "carefully", "carry", "case", "cat", "catch", "caught", "cause", "cell", "chair", "chance", "change", "chase", "check", "cheek", "chest", "child", "children", "chuckle", "city", "class", "clean", "clear", "climb", "close", "clothes", "coffee", "cold", "college", "color", "come", "comment", "complete", "completely", "computer", "concern", "confuse", "consider", "continue", "control", "conversation", "cool", "corner", "couch", "could", "couldn't", "counter", "couple", "course", "cover", "crack", "crazy", "cross", "crowd", "cry", "cup", "cut", "cute", "dad", "damn", "dance", "dark", "date", "daughter", "day", "dead", "deal", "dear", "death", "decide", "deep", "definitely", "desk", "did", "didn't", "die", "different", "dinner", "direction", "disappear", "do", "doctor", "does", "doesn't", "dog", "don't", "done", "door", "doubt", "down", "drag", "draw", "dream", "dress", "drink", "drive", "drop", "drove", "dry", "during", "each", "ear", "early", "easily", "easy", "eat", "edge", "either", "else", "empty", "end", "enjoy", "enough", "enter", "entire", "escape", "especially", "even", "evening", "eventually", "ever", "every", "everyone", "everything", "exactly", "except", "excite", "exclaim", "excuse", "expect", "explain", "expression", "eye", "eyebrow", "face", "fact", "fall", "family", "far", "fast", "father", "fault", "favorite", "fear", "feel", "feet", "fell", "felt", "few", "field", "fight", "figure", "fill", "finally", "find", "fine", "finger", "finish", "fire", "first", "fit", "five", "fix", "flash", "flip", "floor", "fly", "focus", "follow", "food", "foot", "for", "force", "forget", "form", "forward", "found", "four", "free", "friend", "from", "front", "frown", "fuck", "full", "fun", "funny", "further", "game", "gasp", "gave", "gaze", "gently", "get", "giggle", "girl", "girlfriend", "give", "given", "glad", "glance", "glare", "glass", "go", "God", "gone", "gonna", "good", "got", "gotten", "grab", "great", "green", "greet", "grey", "grin", "grip", "groan", "ground", "group", "grow", "guard", "guess", "gun", "guy", "had", "hadn't", "hair", "half", "hall", "hallway", "hand", "handle", "hang", "happen", "happy", "hard", "has", "hate", "have", "haven't", "he", "he'd", "he's", "head", "hear", "heard", "heart", "heavy", "held", "hell", "hello", "help", "her", "here", "herself", "hey", "hi", "hide", "high", "him", "himself", "his", "hit", "hold", "home", "hope", "horse", "hospital", "hot", "hour", "house", "how", "however", "hug", "huge", "huh", "human", "hundred", "hung", "hurry", "hurt", "I", "I'd", "I'll", "I'm", "I've", "ice", "idea", "if", "ignore", "imagine", "immediately", "important", "in", "inside", "instead", "interest", "interrupt", "into", "is", "isn't", "it", "it's", "its", "jacket", "jeans", "jerk", "job", "join", "joke", "jump", "just", "keep", "kept", "key", "kick", "kid", "kill", "kind", "kiss", "kitchen", "knee", "knew", "knock", "know", "known", "lady", "land", "large", "last", "late", "laugh", "lay", "lead", "lean", "learn", "least", "leave", "led", "left", "leg", "less", "let", "letter", "lie", "life", "lift", "light", "like", "line", "lip", "listen", "little", "live", "lock", "locker", "long", "look", "lose", "lost", "lot", "loud", "love", "low", "lunch", "mad", "made", "make", "man", "manage", "many", "mark", "marry", "match", "matter", "may", "maybe", "me", "mean", "meant", "meet", "memory", "men", "mention", "met", "middle", "might", "mind", "mine", "minute", "mirror", "miss", "mom", "moment", "money", "month", "mood", "more", "morning", "most", "mother", "mouth", "move", "movie", "Mr.", "Mrs.", "much", "mum", "mumble", "music", "must", "mutter", "my", "myself", "name", "near", "nearly", "neck", "need", "nervous", "never", "new", "next", "nice", "night", "no", "nod", "noise", "none", "normal", "nose", "not", "note", "nothing", "notice", "now", "number", "obviously", "of", "off", "offer", "office", "often", "oh", "okay", "old", "on", "once", "one", "only", "onto", "open", "or", "order", "other", "our", "out", "outside", "over", "own", "pack", "pain", "paint", "pair", "pants", "paper", "parents", "park", "part", "party", "pass", "past", "pause", "pay", "people", "perfect", "perhaps", "person", "phone", "pick", "picture", "piece", "pink", "piss", "place", "plan", "play", "please", "pocket", "point", "police", "pop", "position", "possible", "power", "practically", "present", "press", "pretend", "pretty", "probably", "problem", "promise", "pull", "punch", "push", "put", "question", "quick", "quickly", "quiet", "quietly", "quite", "race", "rain", "raise", "ran", "rang", "rather", "reach", "read", "ready", "real", "realize", "really", "reason", "recognize", "red", "relationship", "relax", "remain", "remember", "remind", "repeat", "reply", "respond", "rest", "return", "ride", "right", "ring", "road", "rock", "roll", "room", "rose", "round", "rub", "run", "rush", "sad", "safe", "said", "same", "sat", "save", "saw", "say", "scare", "school", "scream", "search", "seat", "second", "see", "seem", "seen", "self", "send", "sense", "sent", "serious", "seriously", "set", "settle", "seven", "several", "shadow", "shake", "share", "she", "she'd", "she's", "shift", "shirt", "shit", "shock", "shoe", "shook", "shop", "short", "shot", "should", "shoulder", "shouldn't", "shout", "shove", "show", "shower", "shrug", "shut", "sick", "side", "sigh", "sight", "sign", "silence", "silent", "simply", "since", "single", "sir", "sister", "sit", "situation", "six", "skin", "sky", "slam", "sleep", "slightly", "slip", "slow", "slowly", "small", "smell", "smile", "smirk", "smoke", "snap", "so", "soft", "softly", "some", "somehow", "someone", "something", "sometimes", "somewhere", "son", "song", "soon", "sorry", "sort", "sound", "space", "speak", "spend", "spent", "spoke", "spot", "stair", "stand", "star", "stare", "start", "state", "stay", "step", "stick", "still", "stomach", "stood", "stop", "store", "story", "straight", "strange", "street", "strong", "struggle", "stuck", "student", "study", "stuff", "stupid", "such", "suck", "sudden", "suddenly", "suggest", "summer", "sun", "suppose", "sure", "surprise", "surround", "sweet", "table", "take", "taken", "talk", "tall", "teacher", "team", "tear", "teeth", "tell", "ten", "than", "thank", "that", "that's", "the", "their", "them", "themselves", "then", "there", "there's", "these", "they", "they'd", "they're", "thick", "thing", "think", "third", "this", "those", "though", "thought", "three", "threw", "throat", "through", "throw", "tie", "tight", "time", "tiny", "tire", "to", "today", "together", "told", "tomorrow", "tone", "tongue", "tonight", "too", "took", "top", "totally", "touch", "toward", "town", "track", "trail", "train", "tree", "trip", "trouble", "trust", "truth", "try", "turn", "TV", "twenty", "two", "type", "uncle", "under", "understand", "until", "up", "upon", "us", "use", "usual", "usually", "very", "visit", "voice", "wait", "wake", "walk", "wall", "want", "warm", "warn", "was", "wasn't", "watch", "water", "wave", "way", "we", "we'll", "we're", "we've", "wear", "week", "weird", "well", "went", "were", "weren't", "wet", "what", "what's", "whatever", "when", "where", "whether", "which", "while", "whisper", "white", "who", "whole", "why", "wide", "wife", "will", "wind", "window", "wipe", "wish", "with", "within", "without", "woke", "woman", "women", "won't", "wonder", "wood", "word", "wore", "work", "world", "worry", "worse", "would", "wouldn't", "wow", "wrap", "write", "wrong", "yeah", "year", "yell", "yes", "yet", "you", "you'd", "you'll", "you're", "you've", "young", "your", "yourself", "TRUE"] \ No newline at end of file From 2ce070a938a7b38207b6ed3a4f3b0de541ac3bf6 Mon Sep 17 00:00:00 2001 From: Nytelife26 Date: Mon, 13 May 2024 21:10:03 +0100 Subject: [PATCH 12/14] refactor: replace csv library with simple read --- proselint/checks/restricted/elementary.py | 8 +------- proselint/checks/restricted/top1000.py | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/proselint/checks/restricted/elementary.py b/proselint/checks/restricted/elementary.py index 91cdd4a0d..d1069151d 100644 --- a/proselint/checks/restricted/elementary.py +++ b/proselint/checks/restricted/elementary.py @@ -12,7 +12,6 @@ Elementary """ -import csv try: from importlib.resources import files except ImportError: @@ -23,12 +22,7 @@ _CSV_PATH = 'checks/restricted/elementary.csv' with files(proselint).joinpath(_CSV_PATH).open('r') as data: - reader = csv.reader(data) - wordlist = list() - for row in reader: - wordlist.extend(row) - -ELEMENTARY_WORDS = wordlist + ELEMENTARY_WORDS = data.read().split() @memoize diff --git a/proselint/checks/restricted/top1000.py b/proselint/checks/restricted/top1000.py index 0cbde7f99..aabcd9d68 100644 --- a/proselint/checks/restricted/top1000.py +++ b/proselint/checks/restricted/top1000.py @@ -12,7 +12,6 @@ Top 1000. """ -import csv try: from importlib.resources import files except ImportError: @@ -24,12 +23,7 @@ _CSV_PATH = 'checks/restricted/top1000.csv' with files(proselint).joinpath(_CSV_PATH).open('r') as data: - reader = csv.reader(data) - wordlist = list() - for row in reader: - wordlist.extend(row) - -TOP1000_WORDS = wordlist + TOP1000_WORDS = data.read().split() @memoize From f2eadac8898c54bbabe98d359fca7a6643a6fa4e Mon Sep 17 00:00:00 2001 From: Nytelife26 Date: Mon, 13 May 2024 21:18:12 +0100 Subject: [PATCH 13/14] style: apply lint --- proselint/tools.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/proselint/tools.py b/proselint/tools.py index 9f13975dc..3ef186c5f 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -374,8 +374,8 @@ def _allowed_word(permitted, match: re.Match, /, ignore_case=True): def reverse_existence_check( - text, list, err, msg, ignore_case=True, offset=0 - ): + text, list, err, msg, ignore_case=True, offset=0 +): """Find all words in ``text`` that aren't on the ``list``.""" permitted = set([word.lower() for word in list] if ignore_case else list) allowed_word = functools.partial( @@ -386,17 +386,21 @@ def reverse_existence_check( tokenizer = re.compile(r"\w[\w'-]+\w") # Ignore any that contain numerals - exclusions = re.compile(r'[0-9]') + exclusions = re.compile(r'\d') errors = [ - (m.start() + 1 + offset, - m.end() + offset, - err, - msg.format(m.string[m.start():m.end()]), - None) + ( + m.start() + 1 + offset, + m.end() + offset, + err, + msg.format(m.string[m.start():m.end()]), + None + ) for m in tokenizer.finditer(text) - if not exclusions.search(m.string[m.start():m.end()]) + if ( + not exclusions.search(m.string[m.start():m.end()]) and not allowed_word(m) + ) ] return errors From e257cd7ae6078b8be8276de7521262f198b1d8a7 Mon Sep 17 00:00:00 2001 From: Nytelife26 Date: Mon, 13 May 2024 21:30:32 +0100 Subject: [PATCH 14/14] docs: update error message for restricted.top1000 --- proselint/checks/restricted/top1000.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proselint/checks/restricted/top1000.py b/proselint/checks/restricted/top1000.py index aabcd9d68..efea3e523 100644 --- a/proselint/checks/restricted/top1000.py +++ b/proselint/checks/restricted/top1000.py @@ -30,6 +30,6 @@ def check(text): """Check the text.""" err = "restricted.top1000" - msg = "'{}' is not in the top 1,000 most popular words." + msg = "'{}' is not in the top 1000 most common words." return reverse_existence_check(text, TOP1000_WORDS, err, msg)