Debian Codegraph @

proselint/checks/misc/usage.py

raw
1 """Elementary Rules of Usage.
2
3 ---
4 layout: post
5 source: Strunk & White
6 source_url: ???
7 title: Elementary Rules of Usage
8 date: 2014-06-10 12:31:19
9 categories: writing
10 ---
11
12 Strunk & White say:
13 1. Form the possessive singular of nouns by adding 's.
14 2. In a series of three or more terms with a conjunction, use a comma after
15 each term except the last.
16 3. Enclose parenthetic expressions between commas. ("This rule is difficult to
17 apply.")
18 4. Place a comma before a conjunction introducing an independent clause.
19 5. Do not join independent clauses with a comma; use a semi-colon. Or a period.
20 6. Do not break sentences in two. Do not use periods for the role of commas.
21 7. Use a colon after an independent clause if you introduce: a list of
22 particulars, an appositive, an application, or an illustrative quotation.
23 8. Use a dash to set off an abrupt break or interruption and to announce a
24 long appositive or summary.
25 9. The number of the subject determines the number of the verb. (MDPNB: This
26 will require nltk & syntactic parsing)
27 10. Use the proper case(grammatical gender) of pronouns.
28 * MDPNB: hard case: "Give this work to whoever looks idle." `whoever looks
29 idle` is the object of `to`.
30 11. A participial phrase at the beginning of a sentence must refer to the
31 grammatical subject.
32 """
33
34 # from proselint.tools import memoize
35 # import re
36
37
38 # @memoize
39 # def check(text):
40 # err = "strunk_white.usage"
41 # msg = "Use of '{}'. {}"
42
43 # bad_words = [
44 # "obviously",
45 # "utilize"
46 # ]
47
48 # explanations = {
49 # "obviously":
50 # "This is obviously an inadvisable word to use.",
51 # "utilize":
52 # r"Do you know anyone who *needs* to utilize the word utilize?"
53 # }
54
55 # errors = []
56 # for word in bad_words:
57 # occ = [m for m in re.finditer(word, text.lower())]
58 # for o in occ:
59 # errors.append((o.start(), o.end(), err,
60 # msg.format(word, explanations[word])))
61
62 # return errors