File: waxed.py

package info (click to toggle)
python3-proselint 0.14.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,220 kB
  • sloc: python: 7,173; sh: 6; makefile: 3
file content (54 lines) | stat: -rw-r--r-- 1,842 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""Waxed lyrical.

---
layout:     post
source:     Fowler's Modern English Usage
source_url: bit.ly/1YBG8QJ
title:      Waxed lyrical
date:       2016-03-10 14:48:42
categories: writing
---

Fowler's says:
Its primary meaning 'grow larger, increase' (as opposed to 'wane') leads
naturally to the sense 'pass into a specified state or mood, begin to use a
specified tone. In this meaning a following modifier must be an adj. not an
adverb ('He waxed enthusiastic [not enthusiastically] about Australia').
"""
from proselint.tools import memoize, preferred_forms_check


@memoize
def check(text):
    """Suggest the preferred forms."""
    err = "misc.waxed"
    msg = "The modifier following 'waxed' must be an adj.: '{}' is correct"

    waxes = ["wax", "waxes", "waxed", "waxing"]
    modifiers = [("ebullient", "ebulliently"),
                 ("ecstatic", "ecstatically"),
                 ("eloquent", "eloquently"),
                 ("enthusiastic", "enthusiastically"),
                 ("euphoric", "euphorically"),
                 ("indignant", "indignantly"),
                 ("lyrical", "lyrically"),
                 ("melancholic", "melancholically"),
                 ("metaphorical", "metaphorically"),
                 ("nostalgic", "nostalgically"),
                 ("patriotic", "patriotically"),
                 ("philosophical", "philosophically"),
                 ("poetic", "poetically"),
                 ("rhapsodic", "rhapsodically"),
                 ("romantic", "romantically"),
                 ("sentimental", "sentimentally")
                 ]

    def pairs(word):
        return [[word + ' ' + pair[0], [word + ' ' + pair[1]]]
                for pair in modifiers]

    preferred = []
    for word in waxes:
        preferred += pairs(word)

    return preferred_forms_check(text, preferred, err, msg)