Module:TAMNAMS: Difference between revisions

Ganaram inukshuk (talk | contribs)
Removed periods from abbrevs
Ganaram inukshuk (talk | contribs)
Adjusted prefix lookup to use abbrevs as needed
Line 376: Line 376:


-- Given an interval vector for a mos, produce the name for that interval.
-- Given an interval vector for a mos, produce the name for that interval.
-- Prefix lookup is done automatically if no prefix is provided; defaults to
-- "mos" if no prefix is found. Prefixes are used for the full name for an
-- interval, whereas abbrevs are used for the abbreviated form. (This is
-- because some abbrevs are shorter than the corresponding prefix.)
-- Formats are as follows:
-- - NONE: full name, eg "perfect 4-diastep"
-- - SENTENCE-CASE: same as NONE, but with capitalized first letter
-- - SHORTENED: shortened form, eg "Perf. 4-diastep"
-- - ABBREV: abbreviated form, eg "P4dias"
function p.interval_quality(interval, input_mos, abbrev_format, mos_prefix)
function p.interval_quality(interval, input_mos, abbrev_format, mos_prefix)
local abbrev_format = abbrev_format or "none"
local abbrev_format = abbrev_format or "none"
local mos_prefix = mos_prefix or p.lookup_prefix(input_mos) or "mos"
local mos_prefix = mos_prefix  
or (abbrev_format == "abbrev" and p.lookup_abbrev(input_mos) or p.lookup_prefix(input_mos))
or (abbrev_format == "abbrev" and "m" or "mos")
-- Get the step count of the interval. The sum of L's and s's will always
-- Get the step count of the interval. The sum of L's and s's will always
Line 401: Line 412:
-- reached by going up that interval, from the root. (This is identical to the
-- reached by going up that interval, from the root. (This is identical to the
-- previous function, except it uses "degree" instead of "step".)
-- previous function, except it uses "degree" instead of "step".)
-- Prefix lookup is done automatically, as with interval_quality().
-- Formats are as follows:
-- - NONE: full name, eg "perfect 4-diadegree"
-- - SENTENCE-CASE: same as NONE, but with capitalized first letter
-- - SHORTENED: shortened form, eg "Perf. 4-diadegree"
-- - ABBREV: abbreviated form, eg "P4diad"
function p.degree_quality(interval, input_mos, abbrev_format, mos_prefix)
function p.degree_quality(interval, input_mos, abbrev_format, mos_prefix)
local abbrev_format = abbrev_format or "none"
local abbrev_format = abbrev_format or "none"
local mos_prefix = mos_prefix or p.lookup_prefix(input_mos) or "mos"
local mos_prefix = mos_prefix  
or (abbrev_format == "abbrev" and p.lookup_abbrev(input_mos) or p.lookup_prefix(input_mos))
or (abbrev_format == "abbrev" and "m" or "mos")
-- Get the step count of the interval. The sum of L's and s's will always
-- Get the step count of the interval. The sum of L's and s's will always