Fixed static analysis warnings
This commit is contained in:
parent
8e4be01565
commit
eb9f79ab85
24 changed files with 624 additions and 629 deletions
|
@ -1,3 +1,5 @@
|
|||
include: package:pedantic/analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
|
@ -1,24 +1,24 @@
|
|||
import '../lib/inflection3.dart';
|
||||
import 'package:inflection3/inflection3.dart';
|
||||
|
||||
void main() {
|
||||
// Using 'shortcut' functions.
|
||||
|
||||
print(pluralize("house")); // => "houses"
|
||||
print(convertToPlural("house")); // => "houses", alias for pluralize
|
||||
print(pluralizeVerb("goes")); // => "go"
|
||||
print(singularize("axes")); // => "axis"
|
||||
print(convertToSingular("axes")); // => "axis", alias for pluralize
|
||||
print(singularizeVerb("write")); // => "writes"
|
||||
print(convertToSnakeCase("CamelCaseName")); // => "camel_case_name"
|
||||
print(convertToSpinalCase("CamelCaseName")); // => "camel-case-name"
|
||||
print(past("forgo")); // => "forwent"
|
||||
print(pluralize('house')); // => 'houses'
|
||||
print(convertToPlural('house')); // => 'houses', alias for pluralize
|
||||
print(pluralizeVerb('goes')); // => 'go'
|
||||
print(singularize('axes')); // => 'axis'
|
||||
print(convertToSingular('axes')); // => 'axis', alias for pluralize
|
||||
print(singularizeVerb('write')); // => 'writes'
|
||||
print(convertToSnakeCase('CamelCaseName')); // => 'camel_case_name'
|
||||
print(convertToSpinalCase('CamelCaseName')); // => 'camel-case-name'
|
||||
print(past('forgo')); // => 'forwent'
|
||||
|
||||
// Using default encoders.
|
||||
|
||||
print(PLURAL.convert("virus")); // => "viri"
|
||||
print(SINGULAR.convert("Matrices")); // => "Matrix"
|
||||
print(SINGULAR.convert("species")); // => "species"
|
||||
print(SNAKE_CASE.convert("CamelCaseName")); // => "camel_case_name"
|
||||
print(SPINAL_CASE.convert("CamelCaseName")); // => "camel-case-name"
|
||||
print(PAST.convert("miss")); // => "missed"
|
||||
print(PLURAL.convert('virus')); // => 'viri'
|
||||
print(SINGULAR.convert('Matrices')); // => 'Matrix'
|
||||
print(SINGULAR.convert('species')); // => 'species'
|
||||
print(SNAKE_CASE.convert('CamelCaseName')); // => 'camel_case_name'
|
||||
print(SPINAL_CASE.convert('CamelCaseName')); // => 'camel-case-name'
|
||||
print(PAST.convert('miss')); // => 'missed'
|
||||
}
|
||||
|
|
|
@ -2,322 +2,322 @@
|
|||
|
||||
/// A collection of verbs with irregular past.
|
||||
final Map<String, String> irregularPastVerbs = const {
|
||||
"backslidden": "backslid",
|
||||
"forbidden": "forbade",
|
||||
"stridden": "strode",
|
||||
"stricken": "struck",
|
||||
"brought": "brought",
|
||||
"striven": "strove",
|
||||
"swollen": "swelled",
|
||||
"thought": "thought",
|
||||
"trodden": "trod",
|
||||
"forbade": "forbade",
|
||||
"arisen": "arose",
|
||||
"awoken": "awoke",
|
||||
"beaten": "beat",
|
||||
"became": "became",
|
||||
"become": "became",
|
||||
"bidden": "bid",
|
||||
"bitten": "bit",
|
||||
"broken": "broke",
|
||||
"bought": "bought",
|
||||
"caught": "caught",
|
||||
"choose": "chose",
|
||||
"chosen": "chose",
|
||||
"forbid": "forbade",
|
||||
"dreamt": "dreamt",
|
||||
"driven": "drove",
|
||||
"fallen": "fell",
|
||||
"fought": "fought",
|
||||
"freeze": "froze",
|
||||
"frozen": "froze",
|
||||
"gotten": "got",
|
||||
"ground": "ground",
|
||||
"hidden": "hid",
|
||||
"learnt": "learnt",
|
||||
"proven": "proved",
|
||||
"sought": "sought",
|
||||
"shaken": "shook",
|
||||
"shaven": "shaved",
|
||||
"shrank": "shrank",
|
||||
"shrink": "shrank",
|
||||
"shrunk": "shrank",
|
||||
"spoken": "spoke",
|
||||
"spoilt": "spoilt",
|
||||
"spread": "spread",
|
||||
"sprang": "sprang",
|
||||
"spring": "sprang",
|
||||
"sprung": "sprang",
|
||||
"stolen": "stole",
|
||||
"strewn": "strewed",
|
||||
"strode": "strode",
|
||||
"stride": "strode",
|
||||
"strike": "struck",
|
||||
"strove": "strove",
|
||||
"struck": "struck",
|
||||
"string": "strung",
|
||||
"strung": "strung",
|
||||
"taught": "taught",
|
||||
"thrown": "threw",
|
||||
"thrust": "thrust",
|
||||
"arise": "arose",
|
||||
"arose": "arose",
|
||||
"awake": "awoke",
|
||||
"awoke": "awoke",
|
||||
"borne": "bore",
|
||||
"began": "began",
|
||||
"begin": "began",
|
||||
"begun": "began",
|
||||
"bound": "bound",
|
||||
"bleed": "bled",
|
||||
"blown": "blew",
|
||||
"break": "broke",
|
||||
"breed": "bred",
|
||||
"bring": "brought",
|
||||
"broke": "broke",
|
||||
"build": "built",
|
||||
"built": "built",
|
||||
"burnt": "burnt",
|
||||
"catch": "caught",
|
||||
"chose": "chose",
|
||||
"cling": "clung",
|
||||
"clung": "clung",
|
||||
"creep": "crept",
|
||||
"crept": "crept",
|
||||
"dealt": "dealt",
|
||||
"wound": "wound",
|
||||
"wring": "wrung",
|
||||
"wrung": "wrung",
|
||||
"write": "wrote",
|
||||
"wrote": "wrote",
|
||||
"drawn": "drew",
|
||||
"drank": "drank",
|
||||
"drink": "drank",
|
||||
"drunk": "drank",
|
||||
"drive": "drove",
|
||||
"drove": "drove",
|
||||
"dwelt": "dwelt",
|
||||
"eaten": "ate",
|
||||
"fight": "fought",
|
||||
"found": "found",
|
||||
"fling": "flung",
|
||||
"flung": "flung",
|
||||
"flown": "flew",
|
||||
"froze": "froze",
|
||||
"given": "gave",
|
||||
"grind": "ground",
|
||||
"grown": "grew",
|
||||
"heard": "heard",
|
||||
"knelt": "knelt",
|
||||
"known": "knew",
|
||||
"leant": "leant",
|
||||
"leapt": "leapt",
|
||||
"leave": "left",
|
||||
"meant": "meant",
|
||||
"risen": "rose",
|
||||
"shake": "shook",
|
||||
"shorn": "sheared",
|
||||
"shone": "shone",
|
||||
"shook": "shook",
|
||||
"shoot": "shot",
|
||||
"shown": "showed",
|
||||
"slain": "slew",
|
||||
"sleep": "slept",
|
||||
"slept": "slept",
|
||||
"slide": "slid",
|
||||
"sling": "slung",
|
||||
"slung": "slung",
|
||||
"slunk": "slunk",
|
||||
"smelt": "smelt",
|
||||
"snuck": "snuck",
|
||||
"speak": "spoke",
|
||||
"spelt": "spelt",
|
||||
"spend": "spent",
|
||||
"spent": "spent",
|
||||
"spilt": "spilt",
|
||||
"split": "split",
|
||||
"spoke": "spoke",
|
||||
"stand": "stood",
|
||||
"stood": "stood",
|
||||
"steal": "stole",
|
||||
"stick": "stuck",
|
||||
"stole": "stole",
|
||||
"stuck": "stuck",
|
||||
"sting": "stung",
|
||||
"stung": "stung",
|
||||
"stank": "stank",
|
||||
"stink": "stank",
|
||||
"stunk": "stank",
|
||||
"swear": "swore",
|
||||
"swore": "swore",
|
||||
"sworn": "swore",
|
||||
"sweep": "swept",
|
||||
"swept": "swept",
|
||||
"swing": "swung",
|
||||
"swung": "swung",
|
||||
"taken": "took",
|
||||
"teach": "taught",
|
||||
"think": "thought",
|
||||
"threw": "threw",
|
||||
"throw": "threw",
|
||||
"tread": "trod",
|
||||
"wake": "woke",
|
||||
"woken": "woke",
|
||||
"woven": "wove",
|
||||
"bear": "bore",
|
||||
"bore": "bore",
|
||||
"born": "bore",
|
||||
"beat": "beat",
|
||||
"bend": "bent",
|
||||
"bent": "bent",
|
||||
"bind": "bound",
|
||||
"bite": "bit",
|
||||
"bled": "bled",
|
||||
"blew": "blew",
|
||||
"blow": "blew",
|
||||
"bred": "bred",
|
||||
"cast": "cast",
|
||||
"clad": "clad",
|
||||
"come": "came",
|
||||
"cost": "cost",
|
||||
"deal": "dealt",
|
||||
"does": "did",
|
||||
"done": "did",
|
||||
"draw": "drew",
|
||||
"drew": "drew",
|
||||
"fall": "fell",
|
||||
"feed": "fed",
|
||||
"feel": "felt",
|
||||
"fell": "fell",
|
||||
"felt": "felt",
|
||||
"find": "found",
|
||||
"flee": "fled",
|
||||
"fled": "fled",
|
||||
"flew": "flew",
|
||||
"gave": "gave",
|
||||
"give": "gave",
|
||||
"gone": "went",
|
||||
"grew": "grew",
|
||||
"grow": "grew",
|
||||
"hang": "hung",
|
||||
"hung": "hung",
|
||||
"have": "had",
|
||||
"hear": "heard",
|
||||
"hewn": "hewed",
|
||||
"hide": "hid",
|
||||
"hold": "held",
|
||||
"held": "held",
|
||||
"hurt": "hurt",
|
||||
"keep": "kept",
|
||||
"kept": "kept",
|
||||
"knew": "knew",
|
||||
"know": "knew",
|
||||
"laid": "laid",
|
||||
"lead": "led",
|
||||
"left": "left",
|
||||
"lend": "lent",
|
||||
"lent": "lent",
|
||||
"lain": "lay",
|
||||
"lose": "lost",
|
||||
"lost": "lost",
|
||||
"make": "made",
|
||||
"made": "made",
|
||||
"mean": "meant",
|
||||
"meet": "met",
|
||||
"mown": "mowed",
|
||||
"paid": "paid",
|
||||
"pled": "pled",
|
||||
"read": "read",
|
||||
"ride": "rode",
|
||||
"rode": "rode",
|
||||
"ring": "rang",
|
||||
"rung": "rang",
|
||||
"rise": "rose",
|
||||
"rose": "rose",
|
||||
"sang": "sang",
|
||||
"sawn": "sawed",
|
||||
"said": "said",
|
||||
"seen": "saw",
|
||||
"seek": "sought",
|
||||
"sell": "sold",
|
||||
"slew": "slew",
|
||||
"sold": "sold",
|
||||
"send": "sent",
|
||||
"sent": "sent",
|
||||
"sewn": "sewed",
|
||||
"shed": "shed",
|
||||
"shot": "shot",
|
||||
"shut": "shut",
|
||||
"sing": "sang",
|
||||
"sung": "sang",
|
||||
"slid": "slid",
|
||||
"slit": "slit",
|
||||
"sown": "sowed",
|
||||
"sped": "sped",
|
||||
"spin": "spun",
|
||||
"spun": "spun",
|
||||
"spit": "spit",
|
||||
"spat": "spat",
|
||||
"swam": "swam",
|
||||
"swim": "swam",
|
||||
"swum": "swam",
|
||||
"take": "took",
|
||||
"tear": "tore",
|
||||
"tore": "tore",
|
||||
"torn": "tore",
|
||||
"tell": "told",
|
||||
"told": "told",
|
||||
"took": "took",
|
||||
"trod": "trod",
|
||||
"wear": "wore",
|
||||
"wore": "wore",
|
||||
"worn": "wore",
|
||||
"weep": "wept",
|
||||
"went": "went",
|
||||
"wept": "wept",
|
||||
"were": "were",
|
||||
"wind": "wound",
|
||||
"woke": "woke",
|
||||
"wove": "wove",
|
||||
"are": "were",
|
||||
"ate": "ate",
|
||||
"bet": "bet",
|
||||
"bid": "bid",
|
||||
"bit": "bit",
|
||||
"buy": "bought",
|
||||
"cut": "cut",
|
||||
"did": "did",
|
||||
"dig": "dug",
|
||||
"dug": "dug",
|
||||
"eat": "ate",
|
||||
"fed": "fed",
|
||||
"fly": "flew",
|
||||
"get": "got",
|
||||
"got": "got",
|
||||
"had": "had",
|
||||
"has": "had",
|
||||
"hid": "hid",
|
||||
"hit": "hit",
|
||||
"lay": "laid",
|
||||
"led": "led",
|
||||
"let": "let",
|
||||
"lit": "lit",
|
||||
"met": "met",
|
||||
"pay": "paid",
|
||||
"put": "put",
|
||||
"ran": "ran",
|
||||
"rid": "rid",
|
||||
"run": "ran",
|
||||
"saw": "saw",
|
||||
"say": "said",
|
||||
"see": "saw",
|
||||
"sit": "sat",
|
||||
"sat": "sat",
|
||||
"set": "set",
|
||||
"was": "was",
|
||||
"win": "won",
|
||||
"won": "won",
|
||||
"do": "did",
|
||||
"go": "went",
|
||||
"is": "was",
|
||||
'backslidden': 'backslid',
|
||||
'forbidden': 'forbade',
|
||||
'stridden': 'strode',
|
||||
'stricken': 'struck',
|
||||
'brought': 'brought',
|
||||
'striven': 'strove',
|
||||
'swollen': 'swelled',
|
||||
'thought': 'thought',
|
||||
'trodden': 'trod',
|
||||
'forbade': 'forbade',
|
||||
'arisen': 'arose',
|
||||
'awoken': 'awoke',
|
||||
'beaten': 'beat',
|
||||
'became': 'became',
|
||||
'become': 'became',
|
||||
'bidden': 'bid',
|
||||
'bitten': 'bit',
|
||||
'broken': 'broke',
|
||||
'bought': 'bought',
|
||||
'caught': 'caught',
|
||||
'choose': 'chose',
|
||||
'chosen': 'chose',
|
||||
'forbid': 'forbade',
|
||||
'dreamt': 'dreamt',
|
||||
'driven': 'drove',
|
||||
'fallen': 'fell',
|
||||
'fought': 'fought',
|
||||
'freeze': 'froze',
|
||||
'frozen': 'froze',
|
||||
'gotten': 'got',
|
||||
'ground': 'ground',
|
||||
'hidden': 'hid',
|
||||
'learnt': 'learnt',
|
||||
'proven': 'proved',
|
||||
'sought': 'sought',
|
||||
'shaken': 'shook',
|
||||
'shaven': 'shaved',
|
||||
'shrank': 'shrank',
|
||||
'shrink': 'shrank',
|
||||
'shrunk': 'shrank',
|
||||
'spoken': 'spoke',
|
||||
'spoilt': 'spoilt',
|
||||
'spread': 'spread',
|
||||
'sprang': 'sprang',
|
||||
'spring': 'sprang',
|
||||
'sprung': 'sprang',
|
||||
'stolen': 'stole',
|
||||
'strewn': 'strewed',
|
||||
'strode': 'strode',
|
||||
'stride': 'strode',
|
||||
'strike': 'struck',
|
||||
'strove': 'strove',
|
||||
'struck': 'struck',
|
||||
'string': 'strung',
|
||||
'strung': 'strung',
|
||||
'taught': 'taught',
|
||||
'thrown': 'threw',
|
||||
'thrust': 'thrust',
|
||||
'arise': 'arose',
|
||||
'arose': 'arose',
|
||||
'awake': 'awoke',
|
||||
'awoke': 'awoke',
|
||||
'borne': 'bore',
|
||||
'began': 'began',
|
||||
'begin': 'began',
|
||||
'begun': 'began',
|
||||
'bound': 'bound',
|
||||
'bleed': 'bled',
|
||||
'blown': 'blew',
|
||||
'break': 'broke',
|
||||
'breed': 'bred',
|
||||
'bring': 'brought',
|
||||
'broke': 'broke',
|
||||
'build': 'built',
|
||||
'built': 'built',
|
||||
'burnt': 'burnt',
|
||||
'catch': 'caught',
|
||||
'chose': 'chose',
|
||||
'cling': 'clung',
|
||||
'clung': 'clung',
|
||||
'creep': 'crept',
|
||||
'crept': 'crept',
|
||||
'dealt': 'dealt',
|
||||
'wound': 'wound',
|
||||
'wring': 'wrung',
|
||||
'wrung': 'wrung',
|
||||
'write': 'wrote',
|
||||
'wrote': 'wrote',
|
||||
'drawn': 'drew',
|
||||
'drank': 'drank',
|
||||
'drink': 'drank',
|
||||
'drunk': 'drank',
|
||||
'drive': 'drove',
|
||||
'drove': 'drove',
|
||||
'dwelt': 'dwelt',
|
||||
'eaten': 'ate',
|
||||
'fight': 'fought',
|
||||
'found': 'found',
|
||||
'fling': 'flung',
|
||||
'flung': 'flung',
|
||||
'flown': 'flew',
|
||||
'froze': 'froze',
|
||||
'given': 'gave',
|
||||
'grind': 'ground',
|
||||
'grown': 'grew',
|
||||
'heard': 'heard',
|
||||
'knelt': 'knelt',
|
||||
'known': 'knew',
|
||||
'leant': 'leant',
|
||||
'leapt': 'leapt',
|
||||
'leave': 'left',
|
||||
'meant': 'meant',
|
||||
'risen': 'rose',
|
||||
'shake': 'shook',
|
||||
'shorn': 'sheared',
|
||||
'shone': 'shone',
|
||||
'shook': 'shook',
|
||||
'shoot': 'shot',
|
||||
'shown': 'showed',
|
||||
'slain': 'slew',
|
||||
'sleep': 'slept',
|
||||
'slept': 'slept',
|
||||
'slide': 'slid',
|
||||
'sling': 'slung',
|
||||
'slung': 'slung',
|
||||
'slunk': 'slunk',
|
||||
'smelt': 'smelt',
|
||||
'snuck': 'snuck',
|
||||
'speak': 'spoke',
|
||||
'spelt': 'spelt',
|
||||
'spend': 'spent',
|
||||
'spent': 'spent',
|
||||
'spilt': 'spilt',
|
||||
'split': 'split',
|
||||
'spoke': 'spoke',
|
||||
'stand': 'stood',
|
||||
'stood': 'stood',
|
||||
'steal': 'stole',
|
||||
'stick': 'stuck',
|
||||
'stole': 'stole',
|
||||
'stuck': 'stuck',
|
||||
'sting': 'stung',
|
||||
'stung': 'stung',
|
||||
'stank': 'stank',
|
||||
'stink': 'stank',
|
||||
'stunk': 'stank',
|
||||
'swear': 'swore',
|
||||
'swore': 'swore',
|
||||
'sworn': 'swore',
|
||||
'sweep': 'swept',
|
||||
'swept': 'swept',
|
||||
'swing': 'swung',
|
||||
'swung': 'swung',
|
||||
'taken': 'took',
|
||||
'teach': 'taught',
|
||||
'think': 'thought',
|
||||
'threw': 'threw',
|
||||
'throw': 'threw',
|
||||
'tread': 'trod',
|
||||
'wake': 'woke',
|
||||
'woken': 'woke',
|
||||
'woven': 'wove',
|
||||
'bear': 'bore',
|
||||
'bore': 'bore',
|
||||
'born': 'bore',
|
||||
'beat': 'beat',
|
||||
'bend': 'bent',
|
||||
'bent': 'bent',
|
||||
'bind': 'bound',
|
||||
'bite': 'bit',
|
||||
'bled': 'bled',
|
||||
'blew': 'blew',
|
||||
'blow': 'blew',
|
||||
'bred': 'bred',
|
||||
'cast': 'cast',
|
||||
'clad': 'clad',
|
||||
'come': 'came',
|
||||
'cost': 'cost',
|
||||
'deal': 'dealt',
|
||||
'does': 'did',
|
||||
'done': 'did',
|
||||
'draw': 'drew',
|
||||
'drew': 'drew',
|
||||
'fall': 'fell',
|
||||
'feed': 'fed',
|
||||
'feel': 'felt',
|
||||
'fell': 'fell',
|
||||
'felt': 'felt',
|
||||
'find': 'found',
|
||||
'flee': 'fled',
|
||||
'fled': 'fled',
|
||||
'flew': 'flew',
|
||||
'gave': 'gave',
|
||||
'give': 'gave',
|
||||
'gone': 'went',
|
||||
'grew': 'grew',
|
||||
'grow': 'grew',
|
||||
'hang': 'hung',
|
||||
'hung': 'hung',
|
||||
'have': 'had',
|
||||
'hear': 'heard',
|
||||
'hewn': 'hewed',
|
||||
'hide': 'hid',
|
||||
'hold': 'held',
|
||||
'held': 'held',
|
||||
'hurt': 'hurt',
|
||||
'keep': 'kept',
|
||||
'kept': 'kept',
|
||||
'knew': 'knew',
|
||||
'know': 'knew',
|
||||
'laid': 'laid',
|
||||
'lead': 'led',
|
||||
'left': 'left',
|
||||
'lend': 'lent',
|
||||
'lent': 'lent',
|
||||
'lain': 'lay',
|
||||
'lose': 'lost',
|
||||
'lost': 'lost',
|
||||
'make': 'made',
|
||||
'made': 'made',
|
||||
'mean': 'meant',
|
||||
'meet': 'met',
|
||||
'mown': 'mowed',
|
||||
'paid': 'paid',
|
||||
'pled': 'pled',
|
||||
'read': 'read',
|
||||
'ride': 'rode',
|
||||
'rode': 'rode',
|
||||
'ring': 'rang',
|
||||
'rung': 'rang',
|
||||
'rise': 'rose',
|
||||
'rose': 'rose',
|
||||
'sang': 'sang',
|
||||
'sawn': 'sawed',
|
||||
'said': 'said',
|
||||
'seen': 'saw',
|
||||
'seek': 'sought',
|
||||
'sell': 'sold',
|
||||
'slew': 'slew',
|
||||
'sold': 'sold',
|
||||
'send': 'sent',
|
||||
'sent': 'sent',
|
||||
'sewn': 'sewed',
|
||||
'shed': 'shed',
|
||||
'shot': 'shot',
|
||||
'shut': 'shut',
|
||||
'sing': 'sang',
|
||||
'sung': 'sang',
|
||||
'slid': 'slid',
|
||||
'slit': 'slit',
|
||||
'sown': 'sowed',
|
||||
'sped': 'sped',
|
||||
'spin': 'spun',
|
||||
'spun': 'spun',
|
||||
'spit': 'spit',
|
||||
'spat': 'spat',
|
||||
'swam': 'swam',
|
||||
'swim': 'swam',
|
||||
'swum': 'swam',
|
||||
'take': 'took',
|
||||
'tear': 'tore',
|
||||
'tore': 'tore',
|
||||
'torn': 'tore',
|
||||
'tell': 'told',
|
||||
'told': 'told',
|
||||
'took': 'took',
|
||||
'trod': 'trod',
|
||||
'wear': 'wore',
|
||||
'wore': 'wore',
|
||||
'worn': 'wore',
|
||||
'weep': 'wept',
|
||||
'went': 'went',
|
||||
'wept': 'wept',
|
||||
'were': 'were',
|
||||
'wind': 'wound',
|
||||
'woke': 'woke',
|
||||
'wove': 'wove',
|
||||
'are': 'were',
|
||||
'ate': 'ate',
|
||||
'bet': 'bet',
|
||||
'bid': 'bid',
|
||||
'bit': 'bit',
|
||||
'buy': 'bought',
|
||||
'cut': 'cut',
|
||||
'did': 'did',
|
||||
'dig': 'dug',
|
||||
'dug': 'dug',
|
||||
'eat': 'ate',
|
||||
'fed': 'fed',
|
||||
'fly': 'flew',
|
||||
'get': 'got',
|
||||
'got': 'got',
|
||||
'had': 'had',
|
||||
'has': 'had',
|
||||
'hid': 'hid',
|
||||
'hit': 'hit',
|
||||
'lay': 'laid',
|
||||
'led': 'led',
|
||||
'let': 'let',
|
||||
'lit': 'lit',
|
||||
'met': 'met',
|
||||
'pay': 'paid',
|
||||
'put': 'put',
|
||||
'ran': 'ran',
|
||||
'rid': 'rid',
|
||||
'run': 'ran',
|
||||
'saw': 'saw',
|
||||
'say': 'said',
|
||||
'see': 'saw',
|
||||
'sit': 'sat',
|
||||
'sat': 'sat',
|
||||
'set': 'set',
|
||||
'was': 'was',
|
||||
'win': 'won',
|
||||
'won': 'won',
|
||||
'do': 'did',
|
||||
'go': 'went',
|
||||
'is': 'was',
|
||||
};
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
///
|
||||
/// [A List of 100 Irregular Plural Nouns in English](http://grammar.about.com/od/words/a/A-List-Of-Irregular-Plural-Nouns-In-English.htm)
|
||||
final Map<String, String> irregularPluralNouns = const {
|
||||
"person": "people",
|
||||
"man": "men",
|
||||
"child": "children",
|
||||
"sex": "sexes"
|
||||
'person': 'people',
|
||||
'man': 'men',
|
||||
'child': 'children',
|
||||
'sex': 'sexes'
|
||||
};
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
/// A collection of verbs with irregular plurals.
|
||||
final Map<String, String> irregularPluralVerbs = const {
|
||||
"is": "are",
|
||||
"am": "are",
|
||||
"was": "were",
|
||||
"has": "have"
|
||||
'is': 'are',
|
||||
'am': 'are',
|
||||
'was': 'were',
|
||||
'has': 'have'
|
||||
};
|
||||
|
|
|
@ -25,12 +25,12 @@ class PastEncoder extends Converter<String, String> {
|
|||
|
||||
void addInflectionRule(String presentOrParticiple, dynamic past) {
|
||||
_inflectionRules
|
||||
.add([new RegExp(presentOrParticiple, caseSensitive: false), past]);
|
||||
.add([RegExp(presentOrParticiple, caseSensitive: false), past]);
|
||||
}
|
||||
|
||||
void addIrregularInflectionRule(String presentOrParticiple, String past) {
|
||||
_inflectionRules.add([
|
||||
new RegExp(
|
||||
RegExp(
|
||||
r'^(back|dis|for|fore|in|inter|mis|off|over|out|par|pre|re|type|un|under|up)?' +
|
||||
presentOrParticiple +
|
||||
r'$',
|
||||
|
@ -41,13 +41,14 @@ class PastEncoder extends Converter<String, String> {
|
|||
|
||||
@override
|
||||
String convert(String word) {
|
||||
if (!word.isEmpty) {
|
||||
if (word.contains("ed", word.length - 2)) {
|
||||
RegExp reg = new RegExp(
|
||||
if (word.isNotEmpty) {
|
||||
if (word.contains('ed', word.length - 2)) {
|
||||
var reg = RegExp(
|
||||
r'^(back|dis|for|fore|in|inter|mis|off|over|out|par|pre|re|type|un|under|up)(.+)$');
|
||||
if (reg.hasMatch(word)) {
|
||||
if (!verbsEndingWithEd.contains(reg.firstMatch(word)!.group(2)))
|
||||
if (!verbsEndingWithEd.contains(reg.firstMatch(word)!.group(2))) {
|
||||
return word;
|
||||
}
|
||||
} else if (!verbsEndingWithEd.contains(word)) {
|
||||
return word;
|
||||
}
|
||||
|
@ -65,4 +66,4 @@ class PastEncoder extends Converter<String, String> {
|
|||
}
|
||||
}
|
||||
|
||||
final Converter<String, String> PAST = new PastEncoder();
|
||||
final Converter<String, String> PAST = PastEncoder();
|
||||
|
|
|
@ -41,7 +41,7 @@ class PluralEncoder extends Converter<String, String> {
|
|||
}
|
||||
|
||||
void addInflectionRule(String singular, dynamic plural) {
|
||||
_inflectionRules.add([new RegExp(singular, caseSensitive: false), plural]);
|
||||
_inflectionRules.add([RegExp(singular, caseSensitive: false), plural]);
|
||||
}
|
||||
|
||||
void addIrregularInflectionRule(String singular, String plural) {
|
||||
|
@ -51,23 +51,23 @@ class PluralEncoder extends Converter<String, String> {
|
|||
final prest = plural.substring(1);
|
||||
|
||||
if (s0.toUpperCase() == p0.toUpperCase()) {
|
||||
addInflectionRule('(${s0})${srest}\$', (Match m) => '${m[1]}${prest}');
|
||||
addInflectionRule('(${p0})${prest}\$', (Match m) => '${m[1]}${prest}');
|
||||
addInflectionRule('($s0)$srest\$', (Match m) => '${m[1]}$prest');
|
||||
addInflectionRule('($p0)$prest\$', (Match m) => '${m[1]}$prest');
|
||||
} else {
|
||||
addInflectionRule('${s0.toUpperCase()}(?i)${srest}\$',
|
||||
(Match m) => '${p0.toUpperCase()}${prest}');
|
||||
addInflectionRule('${s0.toLowerCase()}(?i)${srest}\$',
|
||||
(Match m) => '${p0.toUpperCase()}${prest}');
|
||||
addInflectionRule('${p0.toUpperCase()}(?i)${prest}\$',
|
||||
(Match m) => '${p0.toUpperCase()}${prest}');
|
||||
addInflectionRule('${p0.toLowerCase()}(?i)${prest}\$',
|
||||
(Match m) => '${p0.toLowerCase()}${prest}');
|
||||
addInflectionRule('${s0.toUpperCase()}(?i)$srest\$',
|
||||
(Match m) => '${p0.toUpperCase()}$prest');
|
||||
addInflectionRule('${s0.toLowerCase()}(?i)$srest\$',
|
||||
(Match m) => '${p0.toUpperCase()}$prest');
|
||||
addInflectionRule('${p0.toUpperCase()}(?i)$prest\$',
|
||||
(Match m) => '${p0.toUpperCase()}$prest');
|
||||
addInflectionRule('${p0.toLowerCase()}(?i)$prest\$',
|
||||
(Match m) => '${p0.toLowerCase()}$prest');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String convert(String word) {
|
||||
if (!word.isEmpty) {
|
||||
if (word.isNotEmpty) {
|
||||
if (uncountableNouns.contains(word.toLowerCase())) {
|
||||
return word;
|
||||
} else {
|
||||
|
@ -84,4 +84,4 @@ class PluralEncoder extends Converter<String, String> {
|
|||
}
|
||||
}
|
||||
|
||||
final Converter<String, String> PLURAL = new PluralEncoder();
|
||||
final Converter<String, String> PLURAL = PluralEncoder();
|
||||
|
|
|
@ -28,12 +28,12 @@ class PluralVerbEncoder extends Converter<String, String> {
|
|||
}
|
||||
|
||||
void addInflectionRule(String singular, dynamic plural) {
|
||||
_inflectionRules.add([new RegExp(singular, caseSensitive: false), plural]);
|
||||
_inflectionRules.add([RegExp(singular, caseSensitive: false), plural]);
|
||||
}
|
||||
|
||||
@override
|
||||
String convert(String word) {
|
||||
if (!word.isEmpty) {
|
||||
if (word.isNotEmpty) {
|
||||
for (var r in _inflectionRules) {
|
||||
var pattern = r.first as RegExp;
|
||||
if (pattern.hasMatch(word)) {
|
||||
|
@ -46,4 +46,4 @@ class PluralVerbEncoder extends Converter<String, String> {
|
|||
}
|
||||
}
|
||||
|
||||
final Converter<String, String> PLURALVERB = new PluralVerbEncoder();
|
||||
final Converter<String, String> PLURALVERB = PluralVerbEncoder();
|
||||
|
|
|
@ -49,7 +49,7 @@ class SingularEncoder extends Converter<String, String> {
|
|||
}
|
||||
|
||||
void addInflectionRule(String plural, dynamic singular) {
|
||||
_inflectionRules.add([new RegExp(plural, caseSensitive: false), singular]);
|
||||
_inflectionRules.add([RegExp(plural, caseSensitive: false), singular]);
|
||||
}
|
||||
|
||||
void addIrregularInflectionRule(String singular, String plural) {
|
||||
|
@ -59,23 +59,23 @@ class SingularEncoder extends Converter<String, String> {
|
|||
final prest = plural.substring(1);
|
||||
|
||||
if (s0.toUpperCase() == p0.toUpperCase()) {
|
||||
addInflectionRule('(${s0})${srest}\$', (Match m) => '${m[1]}${srest}');
|
||||
addInflectionRule('(${p0})${prest}\$', (Match m) => '${m[1]}${srest}');
|
||||
addInflectionRule('($s0)$srest\$', (Match m) => '${m[1]}$srest');
|
||||
addInflectionRule('($p0)$prest\$', (Match m) => '${m[1]}$srest');
|
||||
} else {
|
||||
addInflectionRule('${s0.toUpperCase()}(?i)${srest}\$',
|
||||
(Match m) => '${s0.toUpperCase()}${srest}');
|
||||
addInflectionRule('${s0.toLowerCase()}(?i)${srest}\$',
|
||||
(Match m) => '${s0.toUpperCase()}${srest}');
|
||||
addInflectionRule('${p0.toUpperCase()}(?i)${prest}\$',
|
||||
(Match m) => '${s0.toUpperCase()}${srest}');
|
||||
addInflectionRule('${p0.toLowerCase()}(?i)${prest}\$',
|
||||
(Match m) => '${s0.toLowerCase()}${srest}');
|
||||
addInflectionRule('${s0.toUpperCase()}(?i)$srest\$',
|
||||
(Match m) => '${s0.toUpperCase()}$srest');
|
||||
addInflectionRule('${s0.toLowerCase()}(?i)$srest\$',
|
||||
(Match m) => '${s0.toUpperCase()}$srest');
|
||||
addInflectionRule('${p0.toUpperCase()}(?i)$prest\$',
|
||||
(Match m) => '${s0.toUpperCase()}$srest');
|
||||
addInflectionRule('${p0.toLowerCase()}(?i)$prest\$',
|
||||
(Match m) => '${s0.toLowerCase()}$srest');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String convert(String word) {
|
||||
if (!word.isEmpty) {
|
||||
if (word.isNotEmpty) {
|
||||
if (uncountableNouns.contains(word.toLowerCase())) {
|
||||
return word;
|
||||
} else {
|
||||
|
@ -92,4 +92,4 @@ class SingularEncoder extends Converter<String, String> {
|
|||
}
|
||||
}
|
||||
|
||||
final Converter<String, String> SINGULAR = new SingularEncoder();
|
||||
final Converter<String, String> SINGULAR = SingularEncoder();
|
||||
|
|
|
@ -25,12 +25,12 @@ class SingularVerbEncoder extends Converter<String, String> {
|
|||
}
|
||||
|
||||
void addInflectionRule(String singular, dynamic plural) {
|
||||
_inflectionRules.add([new RegExp(singular, caseSensitive: false), plural]);
|
||||
_inflectionRules.add([RegExp(singular, caseSensitive: false), plural]);
|
||||
}
|
||||
|
||||
@override
|
||||
String convert(String word) {
|
||||
if (!word.isEmpty) {
|
||||
if (word.isNotEmpty) {
|
||||
for (var r in _inflectionRules) {
|
||||
var pattern = r.first as RegExp;
|
||||
if (pattern.hasMatch(word)) {
|
||||
|
@ -43,4 +43,4 @@ class SingularVerbEncoder extends Converter<String, String> {
|
|||
}
|
||||
}
|
||||
|
||||
final Converter<String, String> SINGULARVERB = new SingularVerbEncoder();
|
||||
final Converter<String, String> SINGULARVERB = SingularVerbEncoder();
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
import 'dart:convert';
|
||||
|
||||
final _underscoreRE0 = new RegExp(r'''([A-Z\d]+)([A-Z][a-z])''');
|
||||
final _underscoreRE1 = new RegExp(r'''([a-z\d])([A-Z])''');
|
||||
final _underscoreRE2 = new RegExp(r'[-\s]');
|
||||
final _underscoreRE0 = RegExp(r'''([A-Z\d]+)([A-Z][a-z])''');
|
||||
final _underscoreRE1 = RegExp(r'''([a-z\d])([A-Z])''');
|
||||
final _underscoreRE2 = RegExp(r'[-\s]');
|
||||
|
||||
class SnakeCaseEncoder extends Converter<String, String> {
|
||||
const SnakeCaseEncoder();
|
||||
|
@ -14,11 +14,11 @@ class SnakeCaseEncoder extends Converter<String, String> {
|
|||
@override
|
||||
String convert(String phrase) {
|
||||
return phrase
|
||||
.replaceAllMapped(_underscoreRE0, (match) => "${match[1]}_${match[2]}")
|
||||
.replaceAllMapped(_underscoreRE1, (match) => "${match[1]}_${match[2]}")
|
||||
.replaceAll(_underscoreRE2, "_")
|
||||
.replaceAllMapped(_underscoreRE0, (match) => '${match[1]}_${match[2]}')
|
||||
.replaceAllMapped(_underscoreRE1, (match) => '${match[1]}_${match[2]}')
|
||||
.replaceAll(_underscoreRE2, '_')
|
||||
.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
const Converter<String, String> SNAKE_CASE = const SnakeCaseEncoder();
|
||||
const Converter<String, String> SNAKE_CASE = SnakeCaseEncoder();
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
import 'dart:convert';
|
||||
|
||||
final _underscoreRE0 = new RegExp(r'''([A-Z\d]+)([A-Z][a-z])''');
|
||||
final _underscoreRE1 = new RegExp(r'''([a-z\d])([A-Z])''');
|
||||
final _underscoreRE2 = new RegExp(r'[_\s]');
|
||||
final _underscoreRE0 = RegExp(r'''([A-Z\d]+)([A-Z][a-z])''');
|
||||
final _underscoreRE1 = RegExp(r'''([a-z\d])([A-Z])''');
|
||||
final _underscoreRE2 = RegExp(r'[_\s]');
|
||||
|
||||
class SpinalCaseEncoder extends Converter<String, String> {
|
||||
const SpinalCaseEncoder();
|
||||
|
@ -14,11 +14,11 @@ class SpinalCaseEncoder extends Converter<String, String> {
|
|||
@override
|
||||
String convert(String phrase) {
|
||||
return phrase
|
||||
.replaceAllMapped(_underscoreRE0, (match) => "${match[1]}-${match[2]}")
|
||||
.replaceAllMapped(_underscoreRE1, (match) => "${match[1]}-${match[2]}")
|
||||
.replaceAll(_underscoreRE2, "-")
|
||||
.replaceAllMapped(_underscoreRE0, (match) => '${match[1]}-${match[2]}')
|
||||
.replaceAllMapped(_underscoreRE1, (match) => '${match[1]}-${match[2]}')
|
||||
.replaceAll(_underscoreRE2, '-')
|
||||
.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
const Converter<String, String> SPINAL_CASE = const SpinalCaseEncoder();
|
||||
const Converter<String, String> SPINAL_CASE = SpinalCaseEncoder();
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
//library inflection2.uncountable;
|
||||
|
||||
/// Uncountable nouns are substances, concepts etc that we cannot divide into
|
||||
/// separate elements. We cannot "count" them.
|
||||
final Set<String> uncountableNouns = new Set.from(const [
|
||||
"equipment",
|
||||
"information",
|
||||
"rice",
|
||||
"money",
|
||||
"species",
|
||||
"series",
|
||||
"fish",
|
||||
"sheep",
|
||||
"jeans",
|
||||
"police"
|
||||
/// separate elements. We cannot 'count' them.
|
||||
final Set<String> uncountableNouns = Set.from(const [
|
||||
'equipment',
|
||||
'information',
|
||||
'rice',
|
||||
'money',
|
||||
'species',
|
||||
'series',
|
||||
'fish',
|
||||
'sheep',
|
||||
'jeans',
|
||||
'police'
|
||||
]);
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
|
||||
/// A collection of verbs ending with -ed.
|
||||
final List<String> verbsEndingWithEd = const [
|
||||
"bed",
|
||||
"bleed",
|
||||
"breed",
|
||||
"embed",
|
||||
"exceed",
|
||||
"feed",
|
||||
"heed",
|
||||
"need",
|
||||
"proceed",
|
||||
"seed",
|
||||
"shred"
|
||||
"speed",
|
||||
"succeed",
|
||||
"ted",
|
||||
"wed",
|
||||
"weed"
|
||||
'bed',
|
||||
'bleed',
|
||||
'breed',
|
||||
'embed',
|
||||
'exceed',
|
||||
'feed',
|
||||
'heed',
|
||||
'need',
|
||||
'proceed',
|
||||
'seed',
|
||||
'shred',
|
||||
'speed',
|
||||
'succeed',
|
||||
'ted',
|
||||
'wed',
|
||||
'weed'
|
||||
];
|
||||
|
|
|
@ -6,3 +6,4 @@ environment:
|
|||
sdk: '>=2.12.0 <3.0.0'
|
||||
dev_dependencies:
|
||||
test: ^1.17.4
|
||||
pedantic: ^1.11.0
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
library inflection3.test;
|
||||
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../lib/inflection3.dart';
|
||||
import 'package:inflection3/inflection3.dart';
|
||||
|
||||
void main() {
|
||||
group("The inflection library", () {
|
||||
test("provides a few convenient helper functions", () {
|
||||
expect(pluralize("axis"), equals("axes"));
|
||||
expect(convertToPlural("axis"), equals("axes"));
|
||||
expect(singularize("Houses"), equals("House"));
|
||||
expect(convertToSingular("Houses"), equals("House"));
|
||||
expect(convertToSnakeCase("CamelCase"), equals("camel_case"));
|
||||
expect(convertToSpinalCase("CamelCase"), equals("camel-case"));
|
||||
group('The inflection library', () {
|
||||
test('provides a few convenient helper functions', () {
|
||||
expect(pluralize('axis'), equals('axes'));
|
||||
expect(convertToPlural('axis'), equals('axes'));
|
||||
expect(singularize('Houses'), equals('House'));
|
||||
expect(convertToSingular('Houses'), equals('House'));
|
||||
expect(convertToSnakeCase('CamelCase'), equals('camel_case'));
|
||||
expect(convertToSpinalCase('CamelCase'), equals('camel-case'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
library inflection3.is_tense.test;
|
||||
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../lib/inflection3.dart';
|
||||
import 'package:inflection3/inflection3.dart';
|
||||
|
||||
void main() {
|
||||
group("isTense", () {
|
||||
group('isTense', () {
|
||||
test('correctly identifies if a word is in past tense', () {
|
||||
expect(isPastTense('run'), false);
|
||||
expect(isPastTense('ran'), true);
|
||||
|
|
|
@ -1,46 +1,45 @@
|
|||
library inflection3.past.test;
|
||||
|
||||
import 'package:inflection3/inflection3.dart';
|
||||
import 'package:inflection3/src/irregular_past_verbs.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../lib/src/irregular_past_verbs.dart';
|
||||
import '../lib/src/past.dart';
|
||||
|
||||
void main() {
|
||||
group("The PastEncoder", () {
|
||||
test("converts verbs from present or participle to past", () {
|
||||
expect(PAST.convert(""), equals(""));
|
||||
expect(PAST.convert("ask"), equals("asked"));
|
||||
expect(PAST.convert("close"), equals("closed"));
|
||||
expect(PAST.convert("die"), equals("died"));
|
||||
expect(PAST.convert("phone"), equals("phoned"));
|
||||
expect(PAST.convert("play"), equals("played"));
|
||||
expect(PAST.convert("destroy"), equals("destroyed"));
|
||||
expect(PAST.convert("show"), equals("showed"));
|
||||
expect(PAST.convert("marry"), equals("married"));
|
||||
expect(PAST.convert("study"), equals("studied"));
|
||||
expect(PAST.convert("visit"), equals("visited"));
|
||||
expect(PAST.convert("miss"), equals("missed"));
|
||||
expect(PAST.convert("watch"), equals("watched"));
|
||||
expect(PAST.convert("finish"), equals("finished"));
|
||||
expect(PAST.convert("fix"), equals("fixed"));
|
||||
expect(PAST.convert("buzz"), equals("buzzed"));
|
||||
expect(PAST.convert("asked"), equals("asked"));
|
||||
expect(PAST.convert("closed"), equals("closed"));
|
||||
expect(PAST.convert("reopened"), equals("reopened"));
|
||||
expect(PAST.convert("unseed"), equals("unseeded"));
|
||||
group('The PastEncoder', () {
|
||||
test('converts verbs from present or participle to past', () {
|
||||
expect(PAST.convert(''), equals(''));
|
||||
expect(PAST.convert('ask'), equals('asked'));
|
||||
expect(PAST.convert('close'), equals('closed'));
|
||||
expect(PAST.convert('die'), equals('died'));
|
||||
expect(PAST.convert('phone'), equals('phoned'));
|
||||
expect(PAST.convert('play'), equals('played'));
|
||||
expect(PAST.convert('destroy'), equals('destroyed'));
|
||||
expect(PAST.convert('show'), equals('showed'));
|
||||
expect(PAST.convert('marry'), equals('married'));
|
||||
expect(PAST.convert('study'), equals('studied'));
|
||||
expect(PAST.convert('visit'), equals('visited'));
|
||||
expect(PAST.convert('miss'), equals('missed'));
|
||||
expect(PAST.convert('watch'), equals('watched'));
|
||||
expect(PAST.convert('finish'), equals('finished'));
|
||||
expect(PAST.convert('fix'), equals('fixed'));
|
||||
expect(PAST.convert('buzz'), equals('buzzed'));
|
||||
expect(PAST.convert('asked'), equals('asked'));
|
||||
expect(PAST.convert('closed'), equals('closed'));
|
||||
expect(PAST.convert('reopened'), equals('reopened'));
|
||||
expect(PAST.convert('unseed'), equals('unseeded'));
|
||||
});
|
||||
|
||||
test("handles irregular past verbs", () {
|
||||
test('handles irregular past verbs', () {
|
||||
irregularPastVerbs.forEach((String presentOrParticiple, String past) {
|
||||
expect(PAST.convert(presentOrParticiple), equals(past));
|
||||
});
|
||||
expect(PAST.convert("forgo"), equals("forwent"));
|
||||
expect(PAST.convert("undo"), equals("undid"));
|
||||
expect(PAST.convert("outsell"), equals("outsold"));
|
||||
expect(PAST.convert("rebreed"), equals("rebred"));
|
||||
expect(PAST.convert("arose"), equals("arose"));
|
||||
expect(PAST.convert("backslid"), equals("backslid"));
|
||||
expect(PAST.convert("forbade"), equals("forbade"));
|
||||
expect(PAST.convert('forgo'), equals('forwent'));
|
||||
expect(PAST.convert('undo'), equals('undid'));
|
||||
expect(PAST.convert('outsell'), equals('outsold'));
|
||||
expect(PAST.convert('rebreed'), equals('rebred'));
|
||||
expect(PAST.convert('arose'), equals('arose'));
|
||||
expect(PAST.convert('backslid'), equals('backslid'));
|
||||
expect(PAST.convert('forbade'), equals('forbade'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,51 +1,50 @@
|
|||
library inflection3.plural.test;
|
||||
|
||||
import 'package:inflection3/inflection3.dart';
|
||||
import 'package:inflection3/src/uncountable_nouns.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../lib/inflection3.dart';
|
||||
import '../lib/src/uncountable_nouns.dart';
|
||||
|
||||
void main() {
|
||||
group("The PluralEncoder", () {
|
||||
test("converts nouns from singular to plural", () {
|
||||
expect(PLURAL.convert(""), equals(""));
|
||||
expect(PLURAL.convert("House"), equals("Houses"));
|
||||
expect(PLURAL.convert("house"), equals("houses"));
|
||||
expect(PLURAL.convert("dog"), equals("dogs"));
|
||||
expect(PLURAL.convert("axis"), equals("axes"));
|
||||
expect(PLURAL.convert("testis"), equals("testes"));
|
||||
expect(PLURAL.convert("octopus"), equals("octopi"));
|
||||
expect(PLURAL.convert("virus"), equals("viri"));
|
||||
expect(PLURAL.convert("octopi"), equals("octopi"));
|
||||
expect(PLURAL.convert("viri"), equals("viri"));
|
||||
expect(PLURAL.convert("alias"), equals("aliases"));
|
||||
expect(PLURAL.convert("status"), equals("statuses"));
|
||||
expect(PLURAL.convert("bus"), equals("buses"));
|
||||
expect(PLURAL.convert("buffalo"), equals("buffaloes"));
|
||||
expect(PLURAL.convert("tomato"), equals("tomatoes"));
|
||||
expect(PLURAL.convert("ultimatum"), equals("ultimata"));
|
||||
expect(PLURAL.convert("pentium"), equals("pentia"));
|
||||
expect(PLURAL.convert("ultimata"), equals("ultimata"));
|
||||
expect(PLURAL.convert("pentia"), equals("pentia"));
|
||||
expect(PLURAL.convert("nemesis"), equals("nemeses"));
|
||||
expect(PLURAL.convert("hive"), equals("hives"));
|
||||
expect(PLURAL.convert("fly"), equals("flies"));
|
||||
expect(PLURAL.convert("dish"), equals("dishes"));
|
||||
expect(PLURAL.convert("bench"), equals("benches"));
|
||||
expect(PLURAL.convert("matrix"), equals("matrices"));
|
||||
expect(PLURAL.convert("vertex"), equals("vertices"));
|
||||
expect(PLURAL.convert("index"), equals("indices"));
|
||||
expect(PLURAL.convert("mouse"), equals("mice"));
|
||||
expect(PLURAL.convert("louse"), equals("lice"));
|
||||
expect(PLURAL.convert("mice"), equals("mice"));
|
||||
expect(PLURAL.convert("lice"), equals("lice"));
|
||||
expect(PLURAL.convert("ox"), equals("oxen"));
|
||||
expect(PLURAL.convert("ox"), equals("oxen"));
|
||||
expect(PLURAL.convert("oxen"), equals("oxen"));
|
||||
expect(PLURAL.convert("quiz"), equals("quizzes"));
|
||||
group('The PluralEncoder', () {
|
||||
test('converts nouns from singular to plural', () {
|
||||
expect(PLURAL.convert(''), equals(''));
|
||||
expect(PLURAL.convert('House'), equals('Houses'));
|
||||
expect(PLURAL.convert('house'), equals('houses'));
|
||||
expect(PLURAL.convert('dog'), equals('dogs'));
|
||||
expect(PLURAL.convert('axis'), equals('axes'));
|
||||
expect(PLURAL.convert('testis'), equals('testes'));
|
||||
expect(PLURAL.convert('octopus'), equals('octopi'));
|
||||
expect(PLURAL.convert('virus'), equals('viri'));
|
||||
expect(PLURAL.convert('octopi'), equals('octopi'));
|
||||
expect(PLURAL.convert('viri'), equals('viri'));
|
||||
expect(PLURAL.convert('alias'), equals('aliases'));
|
||||
expect(PLURAL.convert('status'), equals('statuses'));
|
||||
expect(PLURAL.convert('bus'), equals('buses'));
|
||||
expect(PLURAL.convert('buffalo'), equals('buffaloes'));
|
||||
expect(PLURAL.convert('tomato'), equals('tomatoes'));
|
||||
expect(PLURAL.convert('ultimatum'), equals('ultimata'));
|
||||
expect(PLURAL.convert('pentium'), equals('pentia'));
|
||||
expect(PLURAL.convert('ultimata'), equals('ultimata'));
|
||||
expect(PLURAL.convert('pentia'), equals('pentia'));
|
||||
expect(PLURAL.convert('nemesis'), equals('nemeses'));
|
||||
expect(PLURAL.convert('hive'), equals('hives'));
|
||||
expect(PLURAL.convert('fly'), equals('flies'));
|
||||
expect(PLURAL.convert('dish'), equals('dishes'));
|
||||
expect(PLURAL.convert('bench'), equals('benches'));
|
||||
expect(PLURAL.convert('matrix'), equals('matrices'));
|
||||
expect(PLURAL.convert('vertex'), equals('vertices'));
|
||||
expect(PLURAL.convert('index'), equals('indices'));
|
||||
expect(PLURAL.convert('mouse'), equals('mice'));
|
||||
expect(PLURAL.convert('louse'), equals('lice'));
|
||||
expect(PLURAL.convert('mice'), equals('mice'));
|
||||
expect(PLURAL.convert('lice'), equals('lice'));
|
||||
expect(PLURAL.convert('ox'), equals('oxen'));
|
||||
expect(PLURAL.convert('ox'), equals('oxen'));
|
||||
expect(PLURAL.convert('oxen'), equals('oxen'));
|
||||
expect(PLURAL.convert('quiz'), equals('quizzes'));
|
||||
});
|
||||
|
||||
test("handles uncountable nouns", () {
|
||||
test('handles uncountable nouns', () {
|
||||
uncountableNouns.forEach((noun) {
|
||||
expect(PLURAL.convert(noun), equals(noun));
|
||||
});
|
||||
|
@ -56,11 +55,11 @@ void main() {
|
|||
});
|
||||
});
|
||||
|
||||
test("handles irregular plural nouns", () {
|
||||
expect(PLURAL.convert("person"), equals("people"));
|
||||
expect(PLURAL.convert("Child"), equals("Children"));
|
||||
expect(PLURAL.convert("children"), equals("children"));
|
||||
expect(PLURAL.convert("man"), equals("men"));
|
||||
test('handles irregular plural nouns', () {
|
||||
expect(PLURAL.convert('person'), equals('people'));
|
||||
expect(PLURAL.convert('Child'), equals('Children'));
|
||||
expect(PLURAL.convert('children'), equals('children'));
|
||||
expect(PLURAL.convert('man'), equals('men'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,35 +1,34 @@
|
|||
library inflection3.plural_verb.test;
|
||||
|
||||
import 'package:inflection3/inflection3.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../lib/src/plural_verb.dart';
|
||||
|
||||
void main() {
|
||||
group("The PluralVerbEncoder", () {
|
||||
test("converts verbs from singular to plural", () {
|
||||
expect(PLURALVERB.convert(""), equals(""));
|
||||
expect(PLURALVERB.convert("eats"), equals("eat"));
|
||||
expect(PLURALVERB.convert("goes"), equals("go"));
|
||||
expect(PLURALVERB.convert("boxes"), equals("box"));
|
||||
expect(PLURALVERB.convert("pays"), equals("pay"));
|
||||
expect(PLURALVERB.convert("rides"), equals("ride"));
|
||||
expect(PLURALVERB.convert("writes"), equals("write"));
|
||||
expect(PLURALVERB.convert("wears"), equals("wear"));
|
||||
expect(PLURALVERB.convert("steals"), equals("steal"));
|
||||
expect(PLURALVERB.convert("springs"), equals("spring"));
|
||||
expect(PLURALVERB.convert("speaks"), equals("speak"));
|
||||
expect(PLURALVERB.convert("sings"), equals("sing"));
|
||||
expect(PLURALVERB.convert("buses"), equals("bus"));
|
||||
expect(PLURALVERB.convert("knows"), equals("know"));
|
||||
expect(PLURALVERB.convert("hides"), equals("hide"));
|
||||
expect(PLURALVERB.convert("catches"), equals("catch"));
|
||||
group('The PluralVerbEncoder', () {
|
||||
test('converts verbs from singular to plural', () {
|
||||
expect(PLURALVERB.convert(''), equals(''));
|
||||
expect(PLURALVERB.convert('eats'), equals('eat'));
|
||||
expect(PLURALVERB.convert('goes'), equals('go'));
|
||||
expect(PLURALVERB.convert('boxes'), equals('box'));
|
||||
expect(PLURALVERB.convert('pays'), equals('pay'));
|
||||
expect(PLURALVERB.convert('rides'), equals('ride'));
|
||||
expect(PLURALVERB.convert('writes'), equals('write'));
|
||||
expect(PLURALVERB.convert('wears'), equals('wear'));
|
||||
expect(PLURALVERB.convert('steals'), equals('steal'));
|
||||
expect(PLURALVERB.convert('springs'), equals('spring'));
|
||||
expect(PLURALVERB.convert('speaks'), equals('speak'));
|
||||
expect(PLURALVERB.convert('sings'), equals('sing'));
|
||||
expect(PLURALVERB.convert('buses'), equals('bus'));
|
||||
expect(PLURALVERB.convert('knows'), equals('know'));
|
||||
expect(PLURALVERB.convert('hides'), equals('hide'));
|
||||
expect(PLURALVERB.convert('catches'), equals('catch'));
|
||||
});
|
||||
|
||||
test("handles irregular plural verbs", () {
|
||||
expect(PLURALVERB.convert("am"), equals("are"));
|
||||
expect(PLURALVERB.convert("is"), equals("are"));
|
||||
expect(PLURALVERB.convert("was"), equals("were"));
|
||||
expect(PLURALVERB.convert("has"), equals("have"));
|
||||
test('handles irregular plural verbs', () {
|
||||
expect(PLURALVERB.convert('am'), equals('are'));
|
||||
expect(PLURALVERB.convert('is'), equals('are'));
|
||||
expect(PLURALVERB.convert('was'), equals('were'));
|
||||
expect(PLURALVERB.convert('has'), equals('have'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,50 +1,49 @@
|
|||
library inflection3.singular.test;
|
||||
|
||||
import 'package:inflection3/inflection3.dart';
|
||||
import 'package:inflection3/src/uncountable_nouns.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../lib/src/singular.dart';
|
||||
import '../lib/src/uncountable_nouns.dart';
|
||||
|
||||
void main() {
|
||||
group("The SingularEncoder", () {
|
||||
test("converts nouns from plural to singular", () {
|
||||
expect(SINGULAR.convert(""), equals(""));
|
||||
expect(SINGULAR.convert("Houses"), equals("House"));
|
||||
expect(SINGULAR.convert("houses"), equals("house"));
|
||||
expect(SINGULAR.convert("ultimata"), equals("ultimatum"));
|
||||
expect(SINGULAR.convert("pentia"), equals("pentium"));
|
||||
expect(SINGULAR.convert("analyses"), equals("analysis"));
|
||||
expect(SINGULAR.convert("diagnoses"), equals("diagnosis"));
|
||||
expect(SINGULAR.convert("Parentheses"), equals("Parenthesis"));
|
||||
expect(SINGULAR.convert("lives"), equals("life"));
|
||||
expect(SINGULAR.convert("hives"), equals("hive"));
|
||||
expect(SINGULAR.convert("tives"), equals("tive"));
|
||||
expect(SINGULAR.convert("shelves"), equals("shelf"));
|
||||
expect(SINGULAR.convert("qualities"), equals("quality"));
|
||||
expect(SINGULAR.convert("series"), equals("series"));
|
||||
expect(SINGULAR.convert("movies"), equals("movie"));
|
||||
expect(SINGULAR.convert("benches"), equals("bench"));
|
||||
expect(SINGULAR.convert("fishes"), equals("fish"));
|
||||
expect(SINGULAR.convert("mice"), equals("mouse"));
|
||||
expect(SINGULAR.convert("lice"), equals("louse"));
|
||||
expect(SINGULAR.convert("buses"), equals("bus"));
|
||||
expect(SINGULAR.convert("shoes"), equals("shoe"));
|
||||
expect(SINGULAR.convert("testis"), equals("testis"));
|
||||
expect(SINGULAR.convert("crisis"), equals("crisis"));
|
||||
expect(SINGULAR.convert("axes"), equals("axis"));
|
||||
expect(SINGULAR.convert("axis"), equals("axis"));
|
||||
expect(SINGULAR.convert("viri"), equals("virus"));
|
||||
expect(SINGULAR.convert("octopi"), equals("octopus"));
|
||||
expect(SINGULAR.convert("aliases"), equals("alias"));
|
||||
expect(SINGULAR.convert("statuses"), equals("status"));
|
||||
expect(SINGULAR.convert("vertices"), equals("vertex"));
|
||||
expect(SINGULAR.convert("indices"), equals("index"));
|
||||
expect(SINGULAR.convert("Matrices"), equals("Matrix"));
|
||||
expect(SINGULAR.convert("quizzes"), equals("quiz"));
|
||||
expect(SINGULAR.convert("databases"), equals("database"));
|
||||
group('The SingularEncoder', () {
|
||||
test('converts nouns from plural to singular', () {
|
||||
expect(SINGULAR.convert(''), equals(''));
|
||||
expect(SINGULAR.convert('Houses'), equals('House'));
|
||||
expect(SINGULAR.convert('houses'), equals('house'));
|
||||
expect(SINGULAR.convert('ultimata'), equals('ultimatum'));
|
||||
expect(SINGULAR.convert('pentia'), equals('pentium'));
|
||||
expect(SINGULAR.convert('analyses'), equals('analysis'));
|
||||
expect(SINGULAR.convert('diagnoses'), equals('diagnosis'));
|
||||
expect(SINGULAR.convert('Parentheses'), equals('Parenthesis'));
|
||||
expect(SINGULAR.convert('lives'), equals('life'));
|
||||
expect(SINGULAR.convert('hives'), equals('hive'));
|
||||
expect(SINGULAR.convert('tives'), equals('tive'));
|
||||
expect(SINGULAR.convert('shelves'), equals('shelf'));
|
||||
expect(SINGULAR.convert('qualities'), equals('quality'));
|
||||
expect(SINGULAR.convert('series'), equals('series'));
|
||||
expect(SINGULAR.convert('movies'), equals('movie'));
|
||||
expect(SINGULAR.convert('benches'), equals('bench'));
|
||||
expect(SINGULAR.convert('fishes'), equals('fish'));
|
||||
expect(SINGULAR.convert('mice'), equals('mouse'));
|
||||
expect(SINGULAR.convert('lice'), equals('louse'));
|
||||
expect(SINGULAR.convert('buses'), equals('bus'));
|
||||
expect(SINGULAR.convert('shoes'), equals('shoe'));
|
||||
expect(SINGULAR.convert('testis'), equals('testis'));
|
||||
expect(SINGULAR.convert('crisis'), equals('crisis'));
|
||||
expect(SINGULAR.convert('axes'), equals('axis'));
|
||||
expect(SINGULAR.convert('axis'), equals('axis'));
|
||||
expect(SINGULAR.convert('viri'), equals('virus'));
|
||||
expect(SINGULAR.convert('octopi'), equals('octopus'));
|
||||
expect(SINGULAR.convert('aliases'), equals('alias'));
|
||||
expect(SINGULAR.convert('statuses'), equals('status'));
|
||||
expect(SINGULAR.convert('vertices'), equals('vertex'));
|
||||
expect(SINGULAR.convert('indices'), equals('index'));
|
||||
expect(SINGULAR.convert('Matrices'), equals('Matrix'));
|
||||
expect(SINGULAR.convert('quizzes'), equals('quiz'));
|
||||
expect(SINGULAR.convert('databases'), equals('database'));
|
||||
});
|
||||
|
||||
test("handles uncountable nouns", () {
|
||||
test('handles uncountable nouns', () {
|
||||
uncountableNouns.forEach((noun) {
|
||||
expect(SINGULAR.convert(noun), equals(noun));
|
||||
});
|
||||
|
@ -55,11 +54,11 @@ void main() {
|
|||
});
|
||||
});
|
||||
|
||||
test("handles irregular plural nouns", () {
|
||||
expect(SINGULAR.convert("people"), equals("person"));
|
||||
expect(SINGULAR.convert("Children"), equals("Child"));
|
||||
expect(SINGULAR.convert("child"), equals("child"));
|
||||
expect(SINGULAR.convert("men"), equals("man"));
|
||||
test('handles irregular plural nouns', () {
|
||||
expect(SINGULAR.convert('people'), equals('person'));
|
||||
expect(SINGULAR.convert('Children'), equals('Child'));
|
||||
expect(SINGULAR.convert('child'), equals('child'));
|
||||
expect(SINGULAR.convert('men'), equals('man'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,34 +1,33 @@
|
|||
library inflection3.singular_verb.test;
|
||||
|
||||
import 'package:inflection3/inflection3.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../lib/src/singular_verb.dart';
|
||||
|
||||
void main() {
|
||||
group("The SingularVerbEncoder", () {
|
||||
test("converts verbs from singular to plural", () {
|
||||
expect(SINGULARVERB.convert(""), equals(""));
|
||||
expect(SINGULARVERB.convert("eat"), equals("eats"));
|
||||
expect(SINGULARVERB.convert("go"), equals("goes"));
|
||||
expect(SINGULARVERB.convert("box"), equals("boxes"));
|
||||
expect(SINGULARVERB.convert("pay"), equals("pays"));
|
||||
expect(SINGULARVERB.convert("ride"), equals("rides"));
|
||||
expect(SINGULARVERB.convert("write"), equals("writes"));
|
||||
expect(SINGULARVERB.convert("wear"), equals("wears"));
|
||||
expect(SINGULARVERB.convert("steal"), equals("steals"));
|
||||
expect(SINGULARVERB.convert("spring"), equals("springs"));
|
||||
expect(SINGULARVERB.convert("speak"), equals("speaks"));
|
||||
expect(SINGULARVERB.convert("sing"), equals("sings"));
|
||||
expect(SINGULARVERB.convert("bus"), equals("buses"));
|
||||
expect(SINGULARVERB.convert("know"), equals("knows"));
|
||||
expect(SINGULARVERB.convert("hide"), equals("hides"));
|
||||
expect(SINGULARVERB.convert("catch"), equals("catches"));
|
||||
group('The SingularVerbEncoder', () {
|
||||
test('converts verbs from singular to plural', () {
|
||||
expect(SINGULARVERB.convert(''), equals(''));
|
||||
expect(SINGULARVERB.convert('eat'), equals('eats'));
|
||||
expect(SINGULARVERB.convert('go'), equals('goes'));
|
||||
expect(SINGULARVERB.convert('box'), equals('boxes'));
|
||||
expect(SINGULARVERB.convert('pay'), equals('pays'));
|
||||
expect(SINGULARVERB.convert('ride'), equals('rides'));
|
||||
expect(SINGULARVERB.convert('write'), equals('writes'));
|
||||
expect(SINGULARVERB.convert('wear'), equals('wears'));
|
||||
expect(SINGULARVERB.convert('steal'), equals('steals'));
|
||||
expect(SINGULARVERB.convert('spring'), equals('springs'));
|
||||
expect(SINGULARVERB.convert('speak'), equals('speaks'));
|
||||
expect(SINGULARVERB.convert('sing'), equals('sings'));
|
||||
expect(SINGULARVERB.convert('bus'), equals('buses'));
|
||||
expect(SINGULARVERB.convert('know'), equals('knows'));
|
||||
expect(SINGULARVERB.convert('hide'), equals('hides'));
|
||||
expect(SINGULARVERB.convert('catch'), equals('catches'));
|
||||
});
|
||||
|
||||
test("handles irregular plural verbs", () {
|
||||
expect(SINGULARVERB.convert("are"), equals("is"));
|
||||
expect(SINGULARVERB.convert("were"), equals("was"));
|
||||
expect(SINGULARVERB.convert("have"), equals("has"));
|
||||
test('handles irregular plural verbs', () {
|
||||
expect(SINGULARVERB.convert('are'), equals('is'));
|
||||
expect(SINGULARVERB.convert('were'), equals('was'));
|
||||
expect(SINGULARVERB.convert('have'), equals('has'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
library inflection3.snake_case.test;
|
||||
|
||||
import 'package:inflection3/inflection3.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../lib/src/snake_case.dart';
|
||||
|
||||
void main() {
|
||||
group("The SnakeCaseEncoder", () {
|
||||
test("converts phrases to 'snake_case'", () {
|
||||
group('The SnakeCaseEncoder', () {
|
||||
test('converts phrases to "snake_case"', () {
|
||||
expect(SNAKE_CASE.convert(''), equals(''));
|
||||
expect(SNAKE_CASE.convert("CamelCaseName"), equals("camel_case_name"));
|
||||
expect(SNAKE_CASE.convert("propertyName"), equals("property_name"));
|
||||
expect(SNAKE_CASE.convert("property"), equals("property"));
|
||||
expect(SNAKE_CASE.convert("lisp-case"), equals("lisp_case"));
|
||||
expect(SNAKE_CASE.convert("This is a nice article"),
|
||||
equals("this_is_a_nice_article"));
|
||||
expect(SNAKE_CASE.convert('CamelCaseName'), equals('camel_case_name'));
|
||||
expect(SNAKE_CASE.convert('propertyName'), equals('property_name'));
|
||||
expect(SNAKE_CASE.convert('property'), equals('property'));
|
||||
expect(SNAKE_CASE.convert('lisp-case'), equals('lisp_case'));
|
||||
expect(SNAKE_CASE.convert('This is a nice article'),
|
||||
equals('this_is_a_nice_article'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
library inflection3.spinal_case.test;
|
||||
|
||||
import 'package:inflection3/inflection3.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../lib/src/spinal_case.dart';
|
||||
|
||||
void main() {
|
||||
group("The SpinalCaseEncoder", () {
|
||||
test("converts phrases to 'spinal-case'", () {
|
||||
group('The SpinalCaseEncoder', () {
|
||||
test('converts phrases to "spinal-case"', () {
|
||||
expect(SPINAL_CASE.convert(''), equals(''));
|
||||
expect(SPINAL_CASE.convert("CamelCaseName"), equals("camel-case-name"));
|
||||
expect(SPINAL_CASE.convert("propertyName"), equals("property-name"));
|
||||
expect(SPINAL_CASE.convert("property"), equals("property"));
|
||||
expect(SPINAL_CASE.convert("snake_case"), equals("snake-case"));
|
||||
expect(SPINAL_CASE.convert("This is a nice article"),
|
||||
equals("this-is-a-nice-article"));
|
||||
expect(SPINAL_CASE.convert('CamelCaseName'), equals('camel-case-name'));
|
||||
expect(SPINAL_CASE.convert('propertyName'), equals('property-name'));
|
||||
expect(SPINAL_CASE.convert('property'), equals('property'));
|
||||
expect(SPINAL_CASE.convert('snake_case'), equals('snake-case'));
|
||||
expect(SPINAL_CASE.convert('This is a nice article'),
|
||||
equals('this-is-a-nice-article'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue