Class: TWFilter::Policy
- Inherits:
-
Data
- Object
- Data
- TWFilter::Policy
- Defined in:
- lib/twfilter/policy.rb,
sig/twfilter.rbs
Instance Attribute Summary collapse
-
#allow_latin ⇒ Object
readonly
Returns the value of attribute allow_latin.
-
#block_tolerance ⇒ Object
readonly
Returns the value of attribute block_tolerance.
-
#evidence_per_100 ⇒ Object
readonly
Returns the value of attribute evidence_per_100.
-
#han_range ⇒ Object
readonly
Returns the value of attribute han_range.
-
#max_tier ⇒ Object
readonly
Returns the value of attribute max_tier.
-
#min_han_ratio ⇒ Object
readonly
Returns the value of attribute min_han_ratio.
-
#orthography_rejects ⇒ Object
readonly
Returns the value of attribute orthography_rejects.
-
#prc_topics_reject ⇒ Object
readonly
Returns the value of attribute prc_topics_reject.
-
#punctuation ⇒ Object
readonly
Returns the value of attribute punctuation.
-
#soft_lexicon_rejects ⇒ Object
readonly
Returns the value of attribute soft_lexicon_rejects.
-
#wenyan_max_density ⇒ Object
readonly
Returns the value of attribute wenyan_max_density.
-
#wenyan_min_han ⇒ Object
readonly
Returns the value of attribute wenyan_min_han.
-
#wenyan_min_hits ⇒ Object
readonly
Returns the value of attribute wenyan_min_hits.
Class Method Summary collapse
-
.corpus ⇒ Policy
6..60 Han characters spans a usable sentence; 0.65 Han excludes list and table fragments while admitting embedded Latin and numerals.
- .permissive ⇒ Policy
-
.publishable ⇒ Policy
Tighter bounds for material shown to learners: 40 Han is a readable card, 0.70 suppresses code-mixed text, and the 常用 chart is the pedagogical inventory.
Instance Method Summary collapse
-
#initialize(han_range: (1..Float::INFINITY), min_han_ratio: 0.0, max_tier: :rare, allow_latin: true, orthography_rejects: true, prc_topics_reject: false, punctuation: :wide, soft_lexicon_rejects: false, wenyan_min_han: 8, wenyan_min_hits: 2, wenyan_max_density: 0.05, block_tolerance: 0.0, evidence_per_100: 1.0) ⇒ Policy
constructor
Defaults impose no shape constraint.
- #tier_limit ⇒ ::Integer
- #with ⇒ Policy
Constructor Details
#initialize(han_range: (1..Float::INFINITY), min_han_ratio: 0.0, max_tier: :rare, allow_latin: true, orthography_rejects: true, prc_topics_reject: false, punctuation: :wide, soft_lexicon_rejects: false, wenyan_min_han: 8, wenyan_min_hits: 2, wenyan_max_density: 0.05, block_tolerance: 0.0, evidence_per_100: 1.0) ⇒ Policy
Defaults impose no shape constraint. Literary-Chinese density fires only above 8 Han characters and 2 particle hits, since the ratio is unstable on shorter spans; 0.05 is the observed ceiling for modern prose quoting classical text. Block tolerance 0.0 rejects a window on one failing member; 1.0 evidence per 100 sentences is the floor below which a window carries no Taiwan-specific signal.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/twfilter/policy.rb', line 27 def initialize( han_range: (1..Float::INFINITY), min_han_ratio: 0.0, max_tier: :rare, allow_latin: true, orthography_rejects: true, prc_topics_reject: false, punctuation: :wide, soft_lexicon_rejects: false, wenyan_min_han: 8, wenyan_min_hits: 2, wenyan_max_density: 0.05, block_tolerance: 0.0, evidence_per_100: 1.0 ) super end |
Instance Attribute Details
#allow_latin ⇒ Object (readonly)
Returns the value of attribute allow_latin
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def allow_latin @allow_latin end |
#block_tolerance ⇒ Object (readonly)
Returns the value of attribute block_tolerance
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def block_tolerance @block_tolerance end |
#evidence_per_100 ⇒ Object (readonly)
Returns the value of attribute evidence_per_100
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def evidence_per_100 @evidence_per_100 end |
#han_range ⇒ Object (readonly)
Returns the value of attribute han_range
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def han_range @han_range end |
#max_tier ⇒ Object (readonly)
Returns the value of attribute max_tier
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def max_tier @max_tier end |
#min_han_ratio ⇒ Object (readonly)
Returns the value of attribute min_han_ratio
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def min_han_ratio @min_han_ratio end |
#orthography_rejects ⇒ Object (readonly)
Returns the value of attribute orthography_rejects
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def orthography_rejects @orthography_rejects end |
#prc_topics_reject ⇒ Object (readonly)
Returns the value of attribute prc_topics_reject
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def prc_topics_reject @prc_topics_reject end |
#punctuation ⇒ Object (readonly)
Returns the value of attribute punctuation
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def punctuation @punctuation end |
#soft_lexicon_rejects ⇒ Object (readonly)
Returns the value of attribute soft_lexicon_rejects
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def soft_lexicon_rejects @soft_lexicon_rejects end |
#wenyan_max_density ⇒ Object (readonly)
Returns the value of attribute wenyan_max_density
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def wenyan_max_density @wenyan_max_density end |
#wenyan_min_han ⇒ Object (readonly)
Returns the value of attribute wenyan_min_han
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def wenyan_min_han @wenyan_min_han end |
#wenyan_min_hits ⇒ Object (readonly)
Returns the value of attribute wenyan_min_hits
7 8 9 |
# File 'lib/twfilter/policy.rb', line 7 def wenyan_min_hits @wenyan_min_hits end |
Class Method Details
.corpus ⇒ Policy
6..60 Han characters spans a usable sentence; 0.65 Han excludes list and table fragments while admitting embedded Latin and numerals.
50 |
# File 'lib/twfilter/policy.rb', line 50 def corpus = new(han_range: (6..60), min_han_ratio: 0.65) |
.publishable ⇒ Policy
Tighter bounds for material shown to learners: 40 Han is a readable card, 0.70 suppresses code-mixed text, and the 常用 chart is the pedagogical inventory.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/twfilter/policy.rb', line 54 def publishable new( han_range: (6..40), min_han_ratio: 0.70, max_tier: :common, soft_lexicon_rejects: true, punctuation: :strict, prc_topics_reject: true ) end |