Coverage for lingpy/settings.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# *-* coding: utf-8 *-* Module handels all global parameters used in a LingPy session. """
# load diacritics, vowels, tones
# these are lexstat-specific parameters, all prefixed by "lexstat" lexstat_transform={ 'A': 'C', 'B': 'C', 'C': 'C', 'L': 'c', 'M': 'c', 'N': 'c', 'X': 'V', 'Y': 'V', 'Z': 'V', 'T': 'T', '_': '_' }, lexstat_runs=1000, lexstat_modes=[("global", -2, 0.5), ("local", -1, 0.5)], lexstat_rands=1000, lexstat_limit=10000, lexstat_scoring_method='shuffle', lexstat_ratio=(2, 1), lexstat_vscale=1.0, lexstat_threshold=0.45, lexstat_cluster_method='upgma', lexstat_preprocessing_method='sca', lexstat_preprocessing_threshold=0.7, lexstat_bad_chars_limit=0.1, lexstat_scoring_threshold=0.7 )
# these are alignment-specific parameters, all prefixed by "align" align_mode='global', align_modes=[('global', -2, 0.5), ('local', -1, 0.5)], align_scale=0.5, align_factor=0.3, align_gap_weight=0.5, align_classes=True, align_sonar=True, align_scorer={}, align_tree_calc='neighbor', align_gop=-2, align_transform={ # new values for alternative prostrings 'A': 1.6, # initial 'B': 1.3, # syllable-initial 'C': 1.2, # ascending 'L': 1.1, # descending 'M': 1.1, # syllable-descending 'N': 0.5, # final 'X': 3.0, # vowel in initial syllable 'Y': 3.0, # vowel in non-final syllable 'Z': 0.7, # vowel in final syllable 'T': 1.0, # Tone '_': 0.0 # break character }, align_notransform={ # new values for alternative prostrings 'A': 1, # initial 'B': 1, # syllable-initial 'C': 1, # ascending 'L': 1, # descending 'M': 1, # syllable-descending 'N': 1, # final 'X': 1, # vowel in initial syllable 'Y': 1, # vowel in non-final syllable 'Z': 1, # vowel in final syllable 'T': 1, # Tone '_': 1 # break character }, align_stamp="""# MSA # dataset : {0} # collection : {1} # aligned by : LingPy Version {2} <www.lingpy.org> # created on : {3} # parameters : {4} """)
# dictionary stores basic parameters that are used during a LingPy session schema='qlc', asjp=Model('asjp'), sca=Model('sca'), dolgo=Model('dolgo'), _color=Model('color'), art=Model('art'), cv=Model('cv'), jaeger=Model('jaeger'), diacritics=diacritics, model=Model('sca'), vowels=vowels, tones=tones, figsize=(10, 10), combiners='\u0361\u035c', breaks='.-', stress="ˈˌ'", merge_vowels=True, unique_sequences=True, comment='#', restricted_chars='_T', scale=0.5, factor=0.3, gap_weight=0.5, classes=True, sonar=True, scorer={}, tree_calc='neighbor', gop=-2, ref='cogid', morpheme_separator="◦", morpheme_separators="◦+→←", nasal_placeholder="∼", gap_symbol="-", word_separator="_", word_separators="_#", )
# define aliases for parameters filename=('filename', 'fn'), merge_vowels=('mv',), sca=("model",), ) # set key as key, just to make sure that the keyword always occurs in the # alias dictionary
# set all the alias values
""" Function changes parameters globally set for LingPy sessions.
Parameters ---------- rval : string (default=None) Use this keyword to specify a return-value for the rc-function. schema : {"ipa", "asjp"} Change the basic schema for sequence comparison. When switching to "asjp", this means that sequences will be treated as sequences in ASJP code, otherwise, they will be treated as sequences written in basic IPA.
Notes ----- This function is the standard way to communicate with the *rcParams* dictionary which is not imported as a default. If you want to see which parameters there are, you can load the rcParams dictonary directly::
>>> from lingpy.settings import rcParams
However, be careful when changing the values. They might produce some unexpected behavior.
Examples -------- Import LingPy:
>>> from lingpy import *
Switch from IPA transcriptions to ASJP transcriptions:
>>> rc(schema="asjp")
You can check which "basic orthography" is currently loaded:
>>> rc(basic_orthography) 'asjp' >>> rc(schema='ipa') >>> rc(basic_orthography) 'fuzzy'
"""
# reset basic model to sca
# reset the basic model to the asjp model
else: |