Esempio n. 1
0
File: pm.py Progetto: jonkeane/amohs
import hs
import funcs
import csv
from os import path

class notationError(Exception):
    pass

fingerCodingKeyFile =path.join(funcs.resources_dir,'fingerCodingKey.csv')
fingerCodingKey = funcs.read_csv_data(fingerCodingKeyFile)
fingerCodingCols = funcs.dictToCols(fingerCodingKey)
bsfingerCodingCols = funcs.dictColMapper(fingerCodingKey, "base symbol")

jointCodingKeyFile =path.join(funcs.resources_dir,'jointCodingKey.csv')
jointCodingKey = funcs.read_csv_data(jointCodingKeyFile)
jointCodingCols = funcs.dictToCols(jointCodingKey)
psfjointCodingCols = funcs.dictColMapper(jointCodingKey, "psf")
ssfjointCodingCols = funcs.dictColMapper(jointCodingKey, "ssf")
nsfjointCodingCols = funcs.dictColMapper(jointCodingKey, "nsf")

abdCodingKeyFile = path.join(funcs.resources_dir,'abdCodingKey.csv')
abdCodingKey = funcs.read_csv_data(abdCodingKeyFile)
abdCodingCols = funcs.dictToCols(abdCodingKey)
psfabdCodingCols = funcs.dictColMapper(abdCodingKey, "psf")
ssfabdCodingCols = funcs.dictColMapper(abdCodingKey, "psf") #ssf is the same as the psf for abduction.

def shortToMember(string):
    map = {'I': 'index',
           'M': 'middle',
           'R': 'ring',
           'P': 'pinky',
Esempio n. 2
0
import hs
import pm
import funcs

import csv
from os import path

##### Error classes #####
class specificationError(Exception):
    pass

##### Read in csvs with letter specifications #####
lettersFile = path.join(funcs.resources_dir,'lettersFromArtModel.csv')
lettersKey = funcs.read_csv_data(lettersFile)
lettersCols = funcs.dictToCols(lettersKey)
letterCodingCols = funcs.dictColMapper(lettersKey, "letter")

def letterToArm(letter):
    """converts a letter to an articulatory model representation of handshape"""
    try:
        let = letterCodingCols[letter]
    except KeyError:
        print("That is not a recognized letter")
        raise
    psf = hs.selectedFingers(
        members = let["psf-members"].split(","), 
        MCP=let["psf-mcp"], 
        PIP=let["psf-pip"], 
        abd=hs.abduction(let["psf-abd"])
        )
    if(let["ssf-members"] == "None"):