tr8n_core 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/README.md +69 -0
  4. data/Rakefile +9 -0
  5. data/config/config.yml +34 -0
  6. data/config/tokens/data.yml +45 -0
  7. data/config/tokens/decorations.yml +37 -0
  8. data/lib/tr8n/application.rb +320 -0
  9. data/lib/tr8n/base.rb +123 -0
  10. data/lib/tr8n/cache.rb +144 -0
  11. data/lib/tr8n/cache_adapters/cdb.rb +74 -0
  12. data/lib/tr8n/cache_adapters/file.rb +70 -0
  13. data/lib/tr8n/cache_adapters/memcache.rb +91 -0
  14. data/lib/tr8n/cache_adapters/redis.rb +94 -0
  15. data/lib/tr8n/component.rb +68 -0
  16. data/lib/tr8n/config.rb +291 -0
  17. data/lib/tr8n/decorators/base.rb +35 -0
  18. data/lib/tr8n/decorators/default.rb +30 -0
  19. data/lib/tr8n/decorators/html.rb +63 -0
  20. data/lib/tr8n/exception.rb +26 -0
  21. data/lib/tr8n/language.rb +250 -0
  22. data/lib/tr8n/language_case.rb +116 -0
  23. data/lib/tr8n/language_case_rule.rb +85 -0
  24. data/lib/tr8n/language_context.rb +115 -0
  25. data/lib/tr8n/language_context_rule.rb +62 -0
  26. data/lib/tr8n/logger.rb +83 -0
  27. data/lib/tr8n/rules_engine/evaluator.rb +156 -0
  28. data/lib/tr8n/rules_engine/parser.rb +83 -0
  29. data/lib/tr8n/source.rb +95 -0
  30. data/lib/tr8n/tokens/data.rb +410 -0
  31. data/lib/tr8n/tokens/data_tokenizer.rb +82 -0
  32. data/lib/tr8n/tokens/decoration_tokenizer.rb +200 -0
  33. data/lib/tr8n/tokens/hidden.rb +48 -0
  34. data/lib/tr8n/tokens/method.rb +52 -0
  35. data/lib/tr8n/tokens/transform.rb +191 -0
  36. data/lib/tr8n/translation.rb +104 -0
  37. data/lib/tr8n/translation_key.rb +205 -0
  38. data/lib/tr8n/translator.rb +62 -0
  39. data/lib/tr8n/utils.rb +124 -0
  40. data/lib/tr8n_core/ext/array.rb +74 -0
  41. data/lib/tr8n_core/ext/date.rb +63 -0
  42. data/lib/tr8n_core/ext/fixnum.rb +39 -0
  43. data/lib/tr8n_core/ext/hash.rb +126 -0
  44. data/lib/tr8n_core/ext/string.rb +44 -0
  45. data/lib/tr8n_core/ext/time.rb +71 -0
  46. data/lib/tr8n_core/generators/cache/base.rb +85 -0
  47. data/lib/tr8n_core/generators/cache/cdb.rb +27 -0
  48. data/lib/tr8n_core/generators/cache/file.rb +69 -0
  49. data/lib/tr8n_core/modules/logger.rb +43 -0
  50. data/lib/tr8n_core/version.rb +27 -0
  51. data/lib/tr8n_core.rb +68 -0
  52. data/spec/application_spec.rb +228 -0
  53. data/spec/base_spec.rb +19 -0
  54. data/spec/config_spec.rb +16 -0
  55. data/spec/decorator_spec.rb +10 -0
  56. data/spec/decorators/base_spec.rb +14 -0
  57. data/spec/decorators/default_spec.rb +12 -0
  58. data/spec/decorators/html_spec.rb +50 -0
  59. data/spec/fixtures/application.json +112 -0
  60. data/spec/fixtures/languages/en-US.json +1424 -0
  61. data/spec/fixtures/languages/es.json +291 -0
  62. data/spec/fixtures/languages/ru.json +550 -0
  63. data/spec/fixtures/translations/ru/basic.json +56 -0
  64. data/spec/fixtures/translations/ru/counters.json +43 -0
  65. data/spec/fixtures/translations/ru/genders.json +171 -0
  66. data/spec/fixtures/translations/ru/last_names.txt +200 -0
  67. data/spec/fixtures/translations/ru/names.json +1 -0
  68. data/spec/fixtures/translations/ru/names.txt +458 -0
  69. data/spec/helper.rb +84 -0
  70. data/spec/language_case_rule_spec.rb +57 -0
  71. data/spec/language_case_spec.rb +58 -0
  72. data/spec/language_context_rule_spec.rb +73 -0
  73. data/spec/language_context_spec.rb +331 -0
  74. data/spec/language_spec.rb +16 -0
  75. data/spec/rules_engine/evaluator_spec.rb +148 -0
  76. data/spec/rules_engine/parser_spec.rb +29 -0
  77. data/spec/tokens/data_spec.rb +160 -0
  78. data/spec/tokens/data_tokenizer_spec.rb +29 -0
  79. data/spec/tokens/decoration_tokenizer_spec.rb +81 -0
  80. data/spec/tokens/hidden_spec.rb +24 -0
  81. data/spec/tokens/method_spec.rb +84 -0
  82. data/spec/tokens/transform_spec.rb +50 -0
  83. data/spec/translation_key_spec.rb +96 -0
  84. data/spec/translation_spec.rb +24 -0
  85. data/spec/utils_spec.rb +64 -0
  86. metadata +176 -0
@@ -0,0 +1,1424 @@
1
+ {
2
+ "locale":"en-US",
3
+ "name":"English (US)",
4
+ "english_name":"English (US)",
5
+ "native_name":"English (US)",
6
+ "flag_url":"http://localhost:3000/media/57/23/20/19/cf185dab9566b718e.png",
7
+ "contexts":{
8
+ "date":{
9
+ "keyword":"date",
10
+ "keys":[
11
+ "past",
12
+ "present",
13
+ "future"
14
+ ],
15
+ "default_key":"present",
16
+ "token_expression":"/.*(date|time)(\\d)*$/",
17
+ "variables":[
18
+ "@date"
19
+ ],
20
+ "token_mapping":[
21
+ "unsupported",
22
+ "unsupported",
23
+ {
24
+ "past":"{$0}",
25
+ "present":"{$1}",
26
+ "future":"{$2}"
27
+ }
28
+ ],
29
+ "rules":{
30
+ "future":{
31
+ "keyword":"future",
32
+ "description":"{token} is in the past",
33
+ "conditions":"(< @date (today))",
34
+ "conditions_expression":[
35
+ "<",
36
+ "@date",
37
+ [
38
+ "today"
39
+ ]
40
+ ]
41
+ },
42
+ "past":{
43
+ "keyword":"past",
44
+ "description":"{token} is in the future",
45
+ "conditions":"(> @date (today))",
46
+ "conditions_expression":[
47
+ ">",
48
+ "@date",
49
+ [
50
+ "today"
51
+ ]
52
+ ]
53
+ },
54
+ "present":{
55
+ "keyword":"present",
56
+ "description":"{token} is in the present",
57
+ "conditions":"(= @date (today))",
58
+ "conditions_expression":[
59
+ "=",
60
+ "@date",
61
+ [
62
+ "today"
63
+ ]
64
+ ]
65
+ }
66
+ }
67
+ },
68
+ "gender":{
69
+ "keyword":"gender",
70
+ "keys":[
71
+ "male",
72
+ "female",
73
+ "other"
74
+ ],
75
+ "default_key":"other",
76
+ "token_expression":"/.*(user|translator|profile|actor|target)(\\d)*$/",
77
+ "variables":[
78
+ "@gender"
79
+ ],
80
+ "token_mapping":[
81
+ {
82
+ "other":"{$0}"
83
+ },
84
+ {
85
+ "male":"{$0}",
86
+ "female":"{$1}",
87
+ "other":"{$0}/{$1}"
88
+ },
89
+ {
90
+ "male":"{$0}",
91
+ "female":"{$1}",
92
+ "other":"{$2}"
93
+ }
94
+ ],
95
+ "rules":{
96
+ "female":{
97
+ "keyword":"female",
98
+ "description":"{token} is a female",
99
+ "conditions":"(= 'female' @gender)",
100
+ "conditions_expression":[
101
+ "=",
102
+ "female",
103
+ "@gender"
104
+ ]
105
+ },
106
+ "male":{
107
+ "keyword":"male",
108
+ "description":"{token} is a male",
109
+ "conditions":"(= 'male' @gender)",
110
+ "conditions_expression":[
111
+ "=",
112
+ "male",
113
+ "@gender"
114
+ ]
115
+ },
116
+ "other":{
117
+ "keyword":"other",
118
+ "description":"{token}'s gender is unknown"
119
+ }
120
+ }
121
+ },
122
+ "genders":{
123
+ "keyword":"genders",
124
+ "keys":[
125
+ "male",
126
+ "female",
127
+ "unknown",
128
+ "other"
129
+ ],
130
+ "default_key":"other",
131
+ "token_expression":"/.*(users|profiles|actors|targets)(\\d)*$/",
132
+ "variables":[
133
+ "@genders"
134
+ ],
135
+ "token_mapping":[
136
+ "unsupported",
137
+ "unsupported",
138
+ "unsupported",
139
+ {
140
+ "male":"{$0}",
141
+ "female":"{$1}",
142
+ "unknown":"{$2}",
143
+ "other":"{$3}"
144
+ }
145
+ ],
146
+ "rules":{
147
+ "female":{
148
+ "keyword":"female",
149
+ "description":"{token} contains 1 female",
150
+ "conditions":"(&& (= 1 (count @genders)) (all @genders 'female'))",
151
+ "conditions_expression":[
152
+ "&&",
153
+ [
154
+ "=",
155
+ 1,
156
+ [
157
+ "count",
158
+ "@genders"
159
+ ]
160
+ ],
161
+ [
162
+ "all",
163
+ "@genders",
164
+ "female"
165
+ ]
166
+ ]
167
+ },
168
+ "male":{
169
+ "keyword":"male",
170
+ "description":"{token} contains 1 male",
171
+ "conditions":"(&& (= 1 (count @genders)) (all @genders 'male'))",
172
+ "conditions_expression":[
173
+ "&&",
174
+ [
175
+ "=",
176
+ 1,
177
+ [
178
+ "count",
179
+ "@genders"
180
+ ]
181
+ ],
182
+ [
183
+ "all",
184
+ "@genders",
185
+ "male"
186
+ ]
187
+ ]
188
+ },
189
+ "other":{
190
+ "keyword":"other",
191
+ "description":"{token} contains at least 2 people"
192
+ },
193
+ "unknown":{
194
+ "keyword":"unknown",
195
+ "description":"{token} contains 1 person with unknown gender",
196
+ "conditions":"(&& (= 1 (count @genders)) (all @genders 'unknown'))",
197
+ "conditions_expression":[
198
+ "&&",
199
+ [
200
+ "=",
201
+ 1,
202
+ [
203
+ "count",
204
+ "@genders"
205
+ ]
206
+ ],
207
+ [
208
+ "all",
209
+ "@genders",
210
+ "unknown"
211
+ ]
212
+ ]
213
+ }
214
+ }
215
+ },
216
+ "list":{
217
+ "keyword":"list",
218
+ "keys":[
219
+ "one",
220
+ "other"
221
+ ],
222
+ "default_key":"other",
223
+ "token_expression":"/.*(items|list)(\\d)*$/",
224
+ "variables":[
225
+ "@count"
226
+ ],
227
+ "token_mapping":[
228
+ "unsupported",
229
+ {
230
+ "one":"{$0}",
231
+ "other":"{$1}"
232
+ }
233
+ ],
234
+ "rules":{
235
+ "one":{
236
+ "keyword":"one",
237
+ "description":"{token} contains 1 element",
238
+ "conditions":"(= 1 @count)",
239
+ "conditions_expression":[
240
+ "=",
241
+ 1,
242
+ "@count"
243
+ ]
244
+ },
245
+ "other":{
246
+ "keyword":"other",
247
+ "description":"{token} contains at least 2 elements"
248
+ }
249
+ }
250
+ },
251
+ "number":{
252
+ "keyword":"number",
253
+ "keys":[
254
+ "one",
255
+ "other"
256
+ ],
257
+ "default_key":"other",
258
+ "token_expression":"/.*(count|num|minutes|seconds|hours|sum|total)(\\d)*$/",
259
+ "variables":[
260
+ "@n"
261
+ ],
262
+ "token_mapping":[
263
+ {
264
+ "one":"{$0}",
265
+ "other":"{$0::plural}"
266
+ },
267
+ {
268
+ "one":"{$0}",
269
+ "other":"{$1}"
270
+ }
271
+ ],
272
+ "rules":{
273
+ "one":{
274
+ "keyword":"one",
275
+ "description":"{token} is 1",
276
+ "examples":"1",
277
+ "conditions":"(= @n 1)",
278
+ "conditions_expression":[
279
+ "=",
280
+ "@n",
281
+ 1
282
+ ]
283
+ },
284
+ "other":{
285
+ "keyword":"other",
286
+ "description":"{token} is not 1",
287
+ "examples":"0, 2-999; 1.2, 2.07..."
288
+ }
289
+ }
290
+ }
291
+ },
292
+ "cases":{
293
+ "ord":{
294
+ "id":67,
295
+ "keyword":"ord",
296
+ "latin_name":"Ordinal",
297
+ "description":"The adjective form of the cardinal numbers",
298
+ "application":"phrase",
299
+ "rules":[
300
+ {
301
+ "id":727,
302
+ "description":"append 'st' if value ends in 1, but not in 11",
303
+ "examples":"1, 21, 31, 41, 101, 121...",
304
+ "conditions":"(&& (match '/1$/' @value) (! (match '/11$/' @value)))",
305
+ "conditions_expression":[
306
+ "&&",
307
+ [
308
+ "match",
309
+ "/1$/",
310
+ "@value"
311
+ ],
312
+ [
313
+ "!",
314
+ [
315
+ "match",
316
+ "/11$/",
317
+ "@value"
318
+ ]
319
+ ]
320
+ ],
321
+ "operations":"(append 'st' @value)",
322
+ "operations_expression":[
323
+ "append",
324
+ "st",
325
+ "@value"
326
+ ]
327
+ },
328
+ {
329
+ "id":728,
330
+ "description":"append 'nd' if value ends in 2, but not in 12",
331
+ "examples":"2, 22, 32, 42, 102, 122...",
332
+ "conditions":"(&& (match '/2$/' @value) (! (match '/12$/' @value)))",
333
+ "conditions_expression":[
334
+ "&&",
335
+ [
336
+ "match",
337
+ "/2$/",
338
+ "@value"
339
+ ],
340
+ [
341
+ "!",
342
+ [
343
+ "match",
344
+ "/12$/",
345
+ "@value"
346
+ ]
347
+ ]
348
+ ],
349
+ "operations":"(append 'nd' @value)",
350
+ "operations_expression":[
351
+ "append",
352
+ "nd",
353
+ "@value"
354
+ ]
355
+ },
356
+ {
357
+ "id":729,
358
+ "description":"append 'nd' if value ends in 3, but not in 13",
359
+ "examples":"3, 23, 33, 43, 103, 123...",
360
+ "conditions":"(&& (match '/3$/' @value) (! (match '/13$/' @value)))",
361
+ "conditions_expression":[
362
+ "&&",
363
+ [
364
+ "match",
365
+ "/3$/",
366
+ "@value"
367
+ ],
368
+ [
369
+ "!",
370
+ [
371
+ "match",
372
+ "/13$/",
373
+ "@value"
374
+ ]
375
+ ]
376
+ ],
377
+ "operations":"(append 'rd' @value)",
378
+ "operations_expression":[
379
+ "append",
380
+ "rd",
381
+ "@value"
382
+ ]
383
+ },
384
+ {
385
+ "id":730,
386
+ "description":"append 'th' in all other cases",
387
+ "examples":"0, 4, 5, 6, 7, 8, 9, 11, 12, 13, 111, 113...",
388
+ "conditions":"(true)",
389
+ "conditions_expression":[
390
+ "true"
391
+ ],
392
+ "operations":"(append 'th' @value)",
393
+ "operations_expression":[
394
+ "append",
395
+ "th",
396
+ "@value"
397
+ ]
398
+ }
399
+ ]
400
+ },
401
+ "ordinal":{
402
+ "id":68,
403
+ "keyword":"ordinal",
404
+ "latin_name":"Ordinal",
405
+ "description":"The adjective form of the cardinal numbers",
406
+ "application":"phrase",
407
+ "rules":[
408
+ {
409
+ "id":731,
410
+ "description":"replace 1 with 'first'",
411
+ "conditions":"(= 1 @value)",
412
+ "conditions_expression":[
413
+ "=",
414
+ 1,
415
+ "@value"
416
+ ],
417
+ "operations":"(replace 1 'first' @value)",
418
+ "operations_expression":[
419
+ "replace",
420
+ 1,
421
+ "first",
422
+ "@value"
423
+ ]
424
+ },
425
+ {
426
+ "id":732,
427
+ "description":"replace 2 with 'second'",
428
+ "conditions":"(= 2 @value)",
429
+ "conditions_expression":[
430
+ "=",
431
+ 2,
432
+ "@value"
433
+ ],
434
+ "operations":"(replace 2 'first' @value)",
435
+ "operations_expression":[
436
+ "replace",
437
+ 2,
438
+ "first",
439
+ "@value"
440
+ ]
441
+ },
442
+ {
443
+ "id":733,
444
+ "description":"replace 3 with 'third'",
445
+ "conditions":"(= 3 @value)",
446
+ "conditions_expression":[
447
+ "=",
448
+ 3,
449
+ "@value"
450
+ ],
451
+ "operations":"(replace 3 'third' @value)",
452
+ "operations_expression":[
453
+ "replace",
454
+ 3,
455
+ "third",
456
+ "@value"
457
+ ]
458
+ }
459
+ ]
460
+ },
461
+ "pos":{
462
+ "id":69,
463
+ "keyword":"pos",
464
+ "latin_name":"Possessive",
465
+ "description":"Used to indicate possession (i.e., ownership). It is usually created by adding 's to the word",
466
+ "application":"phrase",
467
+ "rules":[
468
+ {
469
+ "id":734,
470
+ "description":"if value ends in s, append '",
471
+ "conditions":"(match '/s$/' @value)",
472
+ "conditions_expression":[
473
+ "match",
474
+ "/s$/",
475
+ "@value"
476
+ ],
477
+ "operations":"(append \"'\" @value)",
478
+ "operations_expression":[
479
+ "append",
480
+ "'",
481
+ "@value"
482
+ ]
483
+ },
484
+ {
485
+ "id":735,
486
+ "description":"in all other cases, append 's",
487
+ "conditions":"(true)",
488
+ "conditions_expression":[
489
+ "true"
490
+ ],
491
+ "operations":"(append \"'s\" @value)",
492
+ "operations_expression":[
493
+ "append",
494
+ "'s",
495
+ "@value"
496
+ ]
497
+ }
498
+ ]
499
+ },
500
+ "times":{
501
+ "id":70,
502
+ "keyword":"times",
503
+ "latin_name":"Iteration",
504
+ "description":"The iteration form of the cardinal numbers",
505
+ "application":"phrase",
506
+ "rules":[
507
+ {
508
+ "id":736,
509
+ "description":"replace '1' with 'once'",
510
+ "conditions":"(= 1 @value)",
511
+ "conditions_expression":[
512
+ "=",
513
+ 1,
514
+ "@value"
515
+ ],
516
+ "operations":"(replace '1' 'once' @value)",
517
+ "operations_expression":[
518
+ "replace",
519
+ "1",
520
+ "once",
521
+ "@value"
522
+ ]
523
+ },
524
+ {
525
+ "id":737,
526
+ "description":"replace '2' with 'twice'",
527
+ "conditions":"(= 2 @value)",
528
+ "conditions_expression":[
529
+ "=",
530
+ 2,
531
+ "@value"
532
+ ],
533
+ "operations":"(replace '2' 'twice' @value)",
534
+ "operations_expression":[
535
+ "replace",
536
+ "2",
537
+ "twice",
538
+ "@value"
539
+ ]
540
+ },
541
+ {
542
+ "id":738,
543
+ "description":"in all other cases, append x times",
544
+ "conditions":"(true)",
545
+ "conditions_expression":[
546
+ "true"
547
+ ],
548
+ "operations":"(append ' times' @value)",
549
+ "operations_expression":[
550
+ "append",
551
+ " times",
552
+ "@value"
553
+ ]
554
+ }
555
+ ]
556
+ },
557
+ "plural":{
558
+ "id":71,
559
+ "keyword":"plural",
560
+ "latin_name":"Plural",
561
+ "description":"Converts singular form to plural",
562
+ "application":"phrase",
563
+ "rules":[
564
+ {
565
+ "id":739,
566
+ "description":"Uncountable word",
567
+ "conditions":"(in 'sheep,fish,series,species,money,rice,information,equipment' @value)",
568
+ "conditions_expression":[
569
+ "in",
570
+ "sheep,fish,series,species,money,rice,information,equipment",
571
+ "@value"
572
+ ],
573
+ "operations":"@value",
574
+ "operations_expression":"@value"
575
+ },
576
+ {
577
+ "id":740,
578
+ "description":"Irregular word",
579
+ "conditions":"(= 'move' @value)",
580
+ "conditions_expression":[
581
+ "=",
582
+ "move",
583
+ "@value"
584
+ ],
585
+ "operations":"(quote 'moves')",
586
+ "operations_expression":[
587
+ "quote",
588
+ "moves"
589
+ ]
590
+ },
591
+ {
592
+ "id":741,
593
+ "description":"Irregular word",
594
+ "conditions":"(= 'sex' @value)",
595
+ "conditions_expression":[
596
+ "=",
597
+ "sex",
598
+ "@value"
599
+ ],
600
+ "operations":"(quote 'sexes')",
601
+ "operations_expression":[
602
+ "quote",
603
+ "sexes"
604
+ ]
605
+ },
606
+ {
607
+ "id":742,
608
+ "description":"Irregular word",
609
+ "conditions":"(= 'child' @value)",
610
+ "conditions_expression":[
611
+ "=",
612
+ "child",
613
+ "@value"
614
+ ],
615
+ "operations":"(quote 'children')",
616
+ "operations_expression":[
617
+ "quote",
618
+ "children"
619
+ ]
620
+ },
621
+ {
622
+ "id":743,
623
+ "description":"Irregular word",
624
+ "conditions":"(= 'person' @value)",
625
+ "conditions_expression":[
626
+ "=",
627
+ "person",
628
+ "@value"
629
+ ],
630
+ "operations":"(quote 'people')",
631
+ "operations_expression":[
632
+ "quote",
633
+ "people"
634
+ ]
635
+ },
636
+ {
637
+ "id":744,
638
+ "conditions":"(match '/(quiz)$/i' @value)",
639
+ "conditions_expression":[
640
+ "match",
641
+ "/(quiz)$/i",
642
+ "@value"
643
+ ],
644
+ "operations":"(replace '/(quiz)$/i' '$1zes' @value)",
645
+ "operations_expression":[
646
+ "replace",
647
+ "/(quiz)$/i",
648
+ "$1zes",
649
+ "@value"
650
+ ]
651
+ },
652
+ {
653
+ "id":745,
654
+ "conditions":"(match '/^(ox)$/i' @value)",
655
+ "conditions_expression":[
656
+ "match",
657
+ "/^(ox)$/i",
658
+ "@value"
659
+ ],
660
+ "operations":"(replace '/^(ox)$/i' '$1en' @value)",
661
+ "operations_expression":[
662
+ "replace",
663
+ "/^(ox)$/i",
664
+ "$1en",
665
+ "@value"
666
+ ]
667
+ },
668
+ {
669
+ "id":746,
670
+ "conditions":"(match '/([m|l])ouse$/i' @value)",
671
+ "conditions_expression":[
672
+ "match",
673
+ "/([m|l])ouse$/i",
674
+ "@value"
675
+ ],
676
+ "operations":"(replace '/([m|l])ouse$/i' '$1ice' @value)",
677
+ "operations_expression":[
678
+ "replace",
679
+ "/([m|l])ouse$/i",
680
+ "$1ice",
681
+ "@value"
682
+ ]
683
+ },
684
+ {
685
+ "id":747,
686
+ "conditions":"(match '/(matr|vert|ind)ix|ex$/i' @value)",
687
+ "conditions_expression":[
688
+ "match",
689
+ "/(matr|vert|ind)ix|ex$/i",
690
+ "@value"
691
+ ],
692
+ "operations":"(replace '/(matr|vert|ind)ix|ex$/i' '$1ices' @value)",
693
+ "operations_expression":[
694
+ "replace",
695
+ "/(matr|vert|ind)ix|ex$/i",
696
+ "$1ices",
697
+ "@value"
698
+ ]
699
+ },
700
+ {
701
+ "id":748,
702
+ "conditions":"(match '/(x|ch|ss|sh)$/i' @value)",
703
+ "conditions_expression":[
704
+ "match",
705
+ "/(x|ch|ss|sh)$/i",
706
+ "@value"
707
+ ],
708
+ "operations":"(replace '/(x|ch|ss|sh)$/i' '$1es' @value)",
709
+ "operations_expression":[
710
+ "replace",
711
+ "/(x|ch|ss|sh)$/i",
712
+ "$1es",
713
+ "@value"
714
+ ]
715
+ },
716
+ {
717
+ "id":749,
718
+ "conditions":"(match '/([^aeiouy]|qu)y$/i' @value)",
719
+ "conditions_expression":[
720
+ "match",
721
+ "/([^aeiouy]|qu)y$/i",
722
+ "@value"
723
+ ],
724
+ "operations":"(replace '/([^aeiouy]|qu)y$/i' '$1ies' @value)",
725
+ "operations_expression":[
726
+ "replace",
727
+ "/([^aeiouy]|qu)y$/i",
728
+ "$1ies",
729
+ "@value"
730
+ ]
731
+ },
732
+ {
733
+ "id":750,
734
+ "conditions":"(match '/([^aeiouy]|qu)ies$/i' @value)",
735
+ "conditions_expression":[
736
+ "match",
737
+ "/([^aeiouy]|qu)ies$/i",
738
+ "@value"
739
+ ],
740
+ "operations":"(replace '/([^aeiouy]|qu)ies$/i' '$1y' @value)",
741
+ "operations_expression":[
742
+ "replace",
743
+ "/([^aeiouy]|qu)ies$/i",
744
+ "$1y",
745
+ "@value"
746
+ ]
747
+ },
748
+ {
749
+ "id":751,
750
+ "conditions":"(match '/(hive)$/i' @value)",
751
+ "conditions_expression":[
752
+ "match",
753
+ "/(hive)$/i",
754
+ "@value"
755
+ ],
756
+ "operations":"(replace '/(hive)$/i' '$1s' @value)",
757
+ "operations_expression":[
758
+ "replace",
759
+ "/(hive)$/i",
760
+ "$1s",
761
+ "@value"
762
+ ]
763
+ },
764
+ {
765
+ "id":752,
766
+ "conditions":"(match '/(?:([^f])fe|([lr])f)$/i' @value)",
767
+ "conditions_expression":[
768
+ "match",
769
+ "/(?:([^f])fe|([lr])f)$/i",
770
+ "@value"
771
+ ],
772
+ "operations":"(replace '/(?:([^f])fe|([lr])f)$/i' '$1$2ves' @value)",
773
+ "operations_expression":[
774
+ "replace",
775
+ "/(?:([^f])fe|([lr])f)$/i",
776
+ "$1$2ves",
777
+ "@value"
778
+ ]
779
+ },
780
+ {
781
+ "id":753,
782
+ "conditions":"(match '/sis$/i' @value)",
783
+ "conditions_expression":[
784
+ "match",
785
+ "/sis$/i",
786
+ "@value"
787
+ ],
788
+ "operations":"(replace '/sis$/i' 'ses' @value)",
789
+ "operations_expression":[
790
+ "replace",
791
+ "/sis$/i",
792
+ "ses",
793
+ "@value"
794
+ ]
795
+ },
796
+ {
797
+ "id":754,
798
+ "conditions":"(match '/([ti])um$/i' @value)",
799
+ "conditions_expression":[
800
+ "match",
801
+ "/([ti])um$/i",
802
+ "@value"
803
+ ],
804
+ "operations":"(replace '/([ti])um$/i' '$1a' @value)",
805
+ "operations_expression":[
806
+ "replace",
807
+ "/([ti])um$/i",
808
+ "$1a",
809
+ "@value"
810
+ ]
811
+ },
812
+ {
813
+ "id":755,
814
+ "conditions":"(match '/(buffal|tomat|potat)o$/i' @value)",
815
+ "conditions_expression":[
816
+ "match",
817
+ "/(buffal|tomat|potat)o$/i",
818
+ "@value"
819
+ ],
820
+ "operations":"(replace '/(buffal|tomat|potat)o$/i' '$1oes' @value)",
821
+ "operations_expression":[
822
+ "replace",
823
+ "/(buffal|tomat|potat)o$/i",
824
+ "$1oes",
825
+ "@value"
826
+ ]
827
+ },
828
+ {
829
+ "id":756,
830
+ "conditions":"(match '/(bu)s$/i' @value)",
831
+ "conditions_expression":[
832
+ "match",
833
+ "/(bu)s$/i",
834
+ "@value"
835
+ ],
836
+ "operations":"(replace '/(bu)s$/i' '$1ses' @value)",
837
+ "operations_expression":[
838
+ "replace",
839
+ "/(bu)s$/i",
840
+ "$1ses",
841
+ "@value"
842
+ ]
843
+ },
844
+ {
845
+ "id":757,
846
+ "conditions":"(match '/(alias|status)$/i' @value)",
847
+ "conditions_expression":[
848
+ "match",
849
+ "/(alias|status)$/i",
850
+ "@value"
851
+ ],
852
+ "operations":"(replace '/(alias|status)$/i' '$1es' @value)",
853
+ "operations_expression":[
854
+ "replace",
855
+ "/(alias|status)$/i",
856
+ "$1es",
857
+ "@value"
858
+ ]
859
+ },
860
+ {
861
+ "id":758,
862
+ "conditions":"(match '/(octop)us$/i' @value)",
863
+ "conditions_expression":[
864
+ "match",
865
+ "/(octop)us$/i",
866
+ "@value"
867
+ ],
868
+ "operations":"(replace '/(octop)us$/i' '$1i' @value)",
869
+ "operations_expression":[
870
+ "replace",
871
+ "/(octop)us$/i",
872
+ "$1i",
873
+ "@value"
874
+ ]
875
+ },
876
+ {
877
+ "id":759,
878
+ "conditions":"(match '/(ax|test)is$/i' @value)",
879
+ "conditions_expression":[
880
+ "match",
881
+ "/(ax|test)is$/i",
882
+ "@value"
883
+ ],
884
+ "operations":"(replace '/(ax|test)is$/i' '$1es' @value)",
885
+ "operations_expression":[
886
+ "replace",
887
+ "/(ax|test)is$/i",
888
+ "$1es",
889
+ "@value"
890
+ ]
891
+ },
892
+ {
893
+ "id":760,
894
+ "conditions":"(match '/us$/i' @value)",
895
+ "conditions_expression":[
896
+ "match",
897
+ "/us$/i",
898
+ "@value"
899
+ ],
900
+ "operations":"(replace '/us$/i' '$1es' @value)",
901
+ "operations_expression":[
902
+ "replace",
903
+ "/us$/i",
904
+ "$1es",
905
+ "@value"
906
+ ]
907
+ },
908
+ {
909
+ "id":761,
910
+ "conditions":"(match '/s$/i' @value)",
911
+ "conditions_expression":[
912
+ "match",
913
+ "/s$/i",
914
+ "@value"
915
+ ],
916
+ "operations":"(replace '/s$/i' 's' @value)",
917
+ "operations_expression":[
918
+ "replace",
919
+ "/s$/i",
920
+ "s",
921
+ "@value"
922
+ ]
923
+ },
924
+ {
925
+ "id":762,
926
+ "conditions":"(match '/$/' @value)",
927
+ "conditions_expression":[
928
+ "match",
929
+ "/$/",
930
+ "@value"
931
+ ],
932
+ "operations":"(replace '/$/' 's' @value)",
933
+ "operations_expression":[
934
+ "replace",
935
+ "/$/",
936
+ "s",
937
+ "@value"
938
+ ]
939
+ }
940
+ ]
941
+ },
942
+ "singular":{
943
+ "id":72,
944
+ "keyword":"singular",
945
+ "latin_name":"Singular",
946
+ "description":"Converts plural form to singular",
947
+ "application":"phrase",
948
+ "rules":[
949
+ {
950
+ "id":763,
951
+ "description":"Uncountable word",
952
+ "conditions":"(in 'sheep,fish,series,species,money,rice,information,equipment' @value)",
953
+ "conditions_expression":[
954
+ "in",
955
+ "sheep,fish,series,species,money,rice,information,equipment",
956
+ "@value"
957
+ ],
958
+ "operations":"@value",
959
+ "operations_expression":"@value"
960
+ },
961
+ {
962
+ "id":764,
963
+ "description":"Irregular word",
964
+ "conditions":"(= 'moves' @value)",
965
+ "conditions_expression":[
966
+ "=",
967
+ "moves",
968
+ "@value"
969
+ ],
970
+ "operations":"(quote 'move')",
971
+ "operations_expression":[
972
+ "quote",
973
+ "move"
974
+ ]
975
+ },
976
+ {
977
+ "id":765,
978
+ "description":"Irregular word",
979
+ "conditions":"(= 'sexes' @value)",
980
+ "conditions_expression":[
981
+ "=",
982
+ "sexes",
983
+ "@value"
984
+ ],
985
+ "operations":"(quote 'sex')",
986
+ "operations_expression":[
987
+ "quote",
988
+ "sex"
989
+ ]
990
+ },
991
+ {
992
+ "id":766,
993
+ "description":"Irregular word",
994
+ "conditions":"(= 'children' @value)",
995
+ "conditions_expression":[
996
+ "=",
997
+ "children",
998
+ "@value"
999
+ ],
1000
+ "operations":"(quote 'child')",
1001
+ "operations_expression":[
1002
+ "quote",
1003
+ "child"
1004
+ ]
1005
+ },
1006
+ {
1007
+ "id":767,
1008
+ "description":"Irregular word",
1009
+ "conditions":"(= 'people' @value)",
1010
+ "conditions_expression":[
1011
+ "=",
1012
+ "people",
1013
+ "@value"
1014
+ ],
1015
+ "operations":"(quote 'person')",
1016
+ "operations_expression":[
1017
+ "quote",
1018
+ "person"
1019
+ ]
1020
+ },
1021
+ {
1022
+ "id":768,
1023
+ "conditions":"(match '/(n)ews$/i' @value)",
1024
+ "conditions_expression":[
1025
+ "match",
1026
+ "/(n)ews$/i",
1027
+ "@value"
1028
+ ],
1029
+ "operations":"(replace '/(n)ews$/i' '$1ews' @value)",
1030
+ "operations_expression":[
1031
+ "replace",
1032
+ "/(n)ews$/i",
1033
+ "$1ews",
1034
+ "@value"
1035
+ ]
1036
+ },
1037
+ {
1038
+ "id":769,
1039
+ "conditions":"(match '/([ti])a$/i' @value)",
1040
+ "conditions_expression":[
1041
+ "match",
1042
+ "/([ti])a$/i",
1043
+ "@value"
1044
+ ],
1045
+ "operations":"(replace '/([ti])a$/i' '$1um' @value)",
1046
+ "operations_expression":[
1047
+ "replace",
1048
+ "/([ti])a$/i",
1049
+ "$1um",
1050
+ "@value"
1051
+ ]
1052
+ },
1053
+ {
1054
+ "id":770,
1055
+ "conditions":"(match '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' @value)",
1056
+ "conditions_expression":[
1057
+ "match",
1058
+ "/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i",
1059
+ "@value"
1060
+ ],
1061
+ "operations":"(replace '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' '$1$2sis' @value)",
1062
+ "operations_expression":[
1063
+ "replace",
1064
+ "/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i",
1065
+ "$1$2sis",
1066
+ "@value"
1067
+ ]
1068
+ },
1069
+ {
1070
+ "id":771,
1071
+ "conditions":"(match '/(^analy)ses$/i' @value)",
1072
+ "conditions_expression":[
1073
+ "match",
1074
+ "/(^analy)ses$/i",
1075
+ "@value"
1076
+ ],
1077
+ "operations":"(replace '/(^analy)ses$/i' '$1sis' @value)",
1078
+ "operations_expression":[
1079
+ "replace",
1080
+ "/(^analy)ses$/i",
1081
+ "$1sis",
1082
+ "@value"
1083
+ ]
1084
+ },
1085
+ {
1086
+ "id":772,
1087
+ "conditions":"(match '/([^f])ves$/i' @value)",
1088
+ "conditions_expression":[
1089
+ "match",
1090
+ "/([^f])ves$/i",
1091
+ "@value"
1092
+ ],
1093
+ "operations":"(replace '/([^f])ves$/i' '$1fe' @value)",
1094
+ "operations_expression":[
1095
+ "replace",
1096
+ "/([^f])ves$/i",
1097
+ "$1fe",
1098
+ "@value"
1099
+ ]
1100
+ },
1101
+ {
1102
+ "id":773,
1103
+ "conditions":"(match '/(hive)s$/i' @value)",
1104
+ "conditions_expression":[
1105
+ "match",
1106
+ "/(hive)s$/i",
1107
+ "@value"
1108
+ ],
1109
+ "operations":"(replace '/(hive)s$/i' '$1' @value)",
1110
+ "operations_expression":[
1111
+ "replace",
1112
+ "/(hive)s$/i",
1113
+ "$1",
1114
+ "@value"
1115
+ ]
1116
+ },
1117
+ {
1118
+ "id":774,
1119
+ "conditions":"(match '/(tive)s$/i' @value)",
1120
+ "conditions_expression":[
1121
+ "match",
1122
+ "/(tive)s$/i",
1123
+ "@value"
1124
+ ],
1125
+ "operations":"(replace '/(tive)s$/i' '$1' @value)",
1126
+ "operations_expression":[
1127
+ "replace",
1128
+ "/(tive)s$/i",
1129
+ "$1",
1130
+ "@value"
1131
+ ]
1132
+ },
1133
+ {
1134
+ "id":775,
1135
+ "conditions":"(match '/([lr])ves$/i' @value)",
1136
+ "conditions_expression":[
1137
+ "match",
1138
+ "/([lr])ves$/i",
1139
+ "@value"
1140
+ ],
1141
+ "operations":"(replace '/([lr])ves$/i' '$1f' @value)",
1142
+ "operations_expression":[
1143
+ "replace",
1144
+ "/([lr])ves$/i",
1145
+ "$1f",
1146
+ "@value"
1147
+ ]
1148
+ },
1149
+ {
1150
+ "id":776,
1151
+ "conditions":"(match '/([^aeiouy]|qu)ies$/i' @value)",
1152
+ "conditions_expression":[
1153
+ "match",
1154
+ "/([^aeiouy]|qu)ies$/i",
1155
+ "@value"
1156
+ ],
1157
+ "operations":"(replace '/([^aeiouy]|qu)ies$/i' '$1y' @value)",
1158
+ "operations_expression":[
1159
+ "replace",
1160
+ "/([^aeiouy]|qu)ies$/i",
1161
+ "$1y",
1162
+ "@value"
1163
+ ]
1164
+ },
1165
+ {
1166
+ "id":777,
1167
+ "conditions":"(match '/(s)eries$/i' @value)",
1168
+ "conditions_expression":[
1169
+ "match",
1170
+ "/(s)eries$/i",
1171
+ "@value"
1172
+ ],
1173
+ "operations":"(replace '/(s)eries$/i' '$1eries' @value)",
1174
+ "operations_expression":[
1175
+ "replace",
1176
+ "/(s)eries$/i",
1177
+ "$1eries",
1178
+ "@value"
1179
+ ]
1180
+ },
1181
+ {
1182
+ "id":778,
1183
+ "conditions":"(match '/(m)ovies$/i' @value)",
1184
+ "conditions_expression":[
1185
+ "match",
1186
+ "/(m)ovies$/i",
1187
+ "@value"
1188
+ ],
1189
+ "operations":"(replace '/(m)ovies$/i' '$1ovie' @value)",
1190
+ "operations_expression":[
1191
+ "replace",
1192
+ "/(m)ovies$/i",
1193
+ "$1ovie",
1194
+ "@value"
1195
+ ]
1196
+ },
1197
+ {
1198
+ "id":779,
1199
+ "conditions":"(match '/(x|ch|ss|sh)es$/i' @value)",
1200
+ "conditions_expression":[
1201
+ "match",
1202
+ "/(x|ch|ss|sh)es$/i",
1203
+ "@value"
1204
+ ],
1205
+ "operations":"(replace '/(x|ch|ss|sh)es$/i' '$1' @value)",
1206
+ "operations_expression":[
1207
+ "replace",
1208
+ "/(x|ch|ss|sh)es$/i",
1209
+ "$1",
1210
+ "@value"
1211
+ ]
1212
+ },
1213
+ {
1214
+ "id":780,
1215
+ "conditions":"(match '/([m|l])ice$/i' @value)",
1216
+ "conditions_expression":[
1217
+ "match",
1218
+ "/([m|l])ice$/i",
1219
+ "@value"
1220
+ ],
1221
+ "operations":"(replace '/([m|l])ice$/i' '$1ouse' @value)",
1222
+ "operations_expression":[
1223
+ "replace",
1224
+ "/([m|l])ice$/i",
1225
+ "$1ouse",
1226
+ "@value"
1227
+ ]
1228
+ },
1229
+ {
1230
+ "id":781,
1231
+ "conditions":"(match '/(bus)es$/i' @value)",
1232
+ "conditions_expression":[
1233
+ "match",
1234
+ "/(bus)es$/i",
1235
+ "@value"
1236
+ ],
1237
+ "operations":"(replace '/(bus)es$/i' '$1' @value)",
1238
+ "operations_expression":[
1239
+ "replace",
1240
+ "/(bus)es$/i",
1241
+ "$1",
1242
+ "@value"
1243
+ ]
1244
+ },
1245
+ {
1246
+ "id":782,
1247
+ "conditions":"(match '/(o)es$/i' @value)",
1248
+ "conditions_expression":[
1249
+ "match",
1250
+ "/(o)es$/i",
1251
+ "@value"
1252
+ ],
1253
+ "operations":"(replace '/(o)es$/i' '$1' @value)",
1254
+ "operations_expression":[
1255
+ "replace",
1256
+ "/(o)es$/i",
1257
+ "$1",
1258
+ "@value"
1259
+ ]
1260
+ },
1261
+ {
1262
+ "id":783,
1263
+ "conditions":"(match '/(shoe)s$/i' @value)",
1264
+ "conditions_expression":[
1265
+ "match",
1266
+ "/(shoe)s$/i",
1267
+ "@value"
1268
+ ],
1269
+ "operations":"(replace '/(shoe)s$/i' '$1' @value)",
1270
+ "operations_expression":[
1271
+ "replace",
1272
+ "/(shoe)s$/i",
1273
+ "$1",
1274
+ "@value"
1275
+ ]
1276
+ },
1277
+ {
1278
+ "id":784,
1279
+ "conditions":"(match '/(cris|ax|test)es$/i' @value)",
1280
+ "conditions_expression":[
1281
+ "match",
1282
+ "/(cris|ax|test)es$/i",
1283
+ "@value"
1284
+ ],
1285
+ "operations":"(replace '/(cris|ax|test)es$/i' '$1is' @value)",
1286
+ "operations_expression":[
1287
+ "replace",
1288
+ "/(cris|ax|test)es$/i",
1289
+ "$1is",
1290
+ "@value"
1291
+ ]
1292
+ },
1293
+ {
1294
+ "id":785,
1295
+ "conditions":"(match '/(octop|vir)i$/i' @value)",
1296
+ "conditions_expression":[
1297
+ "match",
1298
+ "/(octop|vir)i$/i",
1299
+ "@value"
1300
+ ],
1301
+ "operations":"(replace '/(octop|vir)i$/i' '$1us' @value)",
1302
+ "operations_expression":[
1303
+ "replace",
1304
+ "/(octop|vir)i$/i",
1305
+ "$1us",
1306
+ "@value"
1307
+ ]
1308
+ },
1309
+ {
1310
+ "id":786,
1311
+ "conditions":"(match '/(alias|status)es$/i' @value)",
1312
+ "conditions_expression":[
1313
+ "match",
1314
+ "/(alias|status)es$/i",
1315
+ "@value"
1316
+ ],
1317
+ "operations":"(replace '/(alias|status)es$/i' '$1' @value)",
1318
+ "operations_expression":[
1319
+ "replace",
1320
+ "/(alias|status)es$/i",
1321
+ "$1",
1322
+ "@value"
1323
+ ]
1324
+ },
1325
+ {
1326
+ "id":787,
1327
+ "conditions":"(match '/^(ox)en$/i' @value)",
1328
+ "conditions_expression":[
1329
+ "match",
1330
+ "/^(ox)en$/i",
1331
+ "@value"
1332
+ ],
1333
+ "operations":"(replace '/^(ox)en$/i' '$1' @value)",
1334
+ "operations_expression":[
1335
+ "replace",
1336
+ "/^(ox)en$/i",
1337
+ "$1",
1338
+ "@value"
1339
+ ]
1340
+ },
1341
+ {
1342
+ "id":788,
1343
+ "conditions":"(match '/(vert|ind)ices$/i' @value)",
1344
+ "conditions_expression":[
1345
+ "match",
1346
+ "/(vert|ind)ices$/i",
1347
+ "@value"
1348
+ ],
1349
+ "operations":"(replace '/(vert|ind)ices$/i' '$1ex' @value)",
1350
+ "operations_expression":[
1351
+ "replace",
1352
+ "/(vert|ind)ices$/i",
1353
+ "$1ex",
1354
+ "@value"
1355
+ ]
1356
+ },
1357
+ {
1358
+ "id":789,
1359
+ "conditions":"(match '/(matr)ices$/i' @value)",
1360
+ "conditions_expression":[
1361
+ "match",
1362
+ "/(matr)ices$/i",
1363
+ "@value"
1364
+ ],
1365
+ "operations":"(replace '/(matr)ices$/i' '$1ix' @value)",
1366
+ "operations_expression":[
1367
+ "replace",
1368
+ "/(matr)ices$/i",
1369
+ "$1ix",
1370
+ "@value"
1371
+ ]
1372
+ },
1373
+ {
1374
+ "id":790,
1375
+ "conditions":"(match '/(quiz)zes$/i' @value)",
1376
+ "conditions_expression":[
1377
+ "match",
1378
+ "/(quiz)zes$/i",
1379
+ "@value"
1380
+ ],
1381
+ "operations":"(replace '/(quiz)zes$/i' '$1' @value)",
1382
+ "operations_expression":[
1383
+ "replace",
1384
+ "/(quiz)zes$/i",
1385
+ "$1",
1386
+ "@value"
1387
+ ]
1388
+ },
1389
+ {
1390
+ "id":791,
1391
+ "conditions":"(match '/(us)es$/i' @value)",
1392
+ "conditions_expression":[
1393
+ "match",
1394
+ "/(us)es$/i",
1395
+ "@value"
1396
+ ],
1397
+ "operations":"(replace '/(us)es$/i' '$1' @value)",
1398
+ "operations_expression":[
1399
+ "replace",
1400
+ "/(us)es$/i",
1401
+ "$1",
1402
+ "@value"
1403
+ ]
1404
+ },
1405
+ {
1406
+ "id":792,
1407
+ "conditions":"(match '/s$/i' @value)",
1408
+ "conditions_expression":[
1409
+ "match",
1410
+ "/s$/i",
1411
+ "@value"
1412
+ ],
1413
+ "operations":"(replace '/s$/i' '' @value)",
1414
+ "operations_expression":[
1415
+ "replace",
1416
+ "/s$/i",
1417
+ "",
1418
+ "@value"
1419
+ ]
1420
+ }
1421
+ ]
1422
+ }
1423
+ }
1424
+ }