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"): ssf = None else: ssf = hs.secondarySelectedFingers( members = let["ssf-members"].split(","), MCP=let["ssf-mcp"], PIP=let["ssf-pip"], abd=hs.abduction(let["ssf-abd"]) ) if(let["thumb-oppos"] == "None"): thmb = None else: thmb = hs.thumb(oppos=let["thumb-oppos"]) if(let["nsf-joints"] == "None"): nsf = None else: nsf = hs.nonSelectedFingers(joints=let["nsf-joints"]) handshape = hs.handshape( selectedFingers = psf, secondarySelectedFingers = ssf, thumb = thmb, nonSelectedFingers = nsf ) orientation = let["orientation"] return hs.arm(handshape=handshape, orientation=orientation)
except: print("Error with "+ltr+". can't convert from PM notation to AM handshape") #ensure that all articulatory model specifications are readable for ltr in lettersCols['letter']: try: letterToArm(ltr) except: print("error with "+ltr+". can't convert from articulatory specifications to AM handshape") #ensure that all articulatory model specifications are readable for ltr in lettersCols['letter']: try: AMarm = letterToArm(ltr) except: print("error with "+ltr+". can't convert from articulatory specifications to AM handshape") break try: PMarm = hs.arm(handshape=letterToPM(ltr).toAMhandshape(), orientation=letterCodingCols[ltr]["orientation"]) except: print("Error with "+ltr+". can't convert from PM notation to AM handshape") break AMPMdiff = AMarm.toArmTarget()-PMarm.toArmTarget() if AMPMdiff.totalDegreesDifferent() > 0: print("The difference between the PM and AM for "+ltr+" is "+str(AMPMdiff.totalDegreesDifferent())+" degrees.") print("Articulatory model:") print(AMarm.toArmTarget()) print("Prosodic model:") print(PMarm.toArmTarget())