class_docstr: Middle English stresser
docstr: The Soundex phonetic indexing algorithm adapted to ME phonology.
  
  Algorithm:
  
  Let w the original word and W the resulting one
  
  1) Capitalize the first letter of w and append it to W
  
  2) Apply the following replacement rules
  
      p, b, f, v, gh (non-nasal fricatives) -> 1
  
      t, d, s, sh, z, r, k, g, w (non-nasal alveolars and velars) -> 2
  
      l (alveolar lateral) -> 3
  
      m, n (nasals) -> 4
  
      r (alveolar approximant) -> 5
  
  3) Concetate multiple occurrences of numbers into one
  
  4) Remove non-numerical characters
  
  Notes:
      /h/ was thought to be either a voiceless or velar fricative
  when occurring in the coda with its most used grapheme being <gh>.
  Those phonemes either disappeared, resulting in the lengthening
  of preceding vowel clusters, or were developed into /f/ as evident
  by modern spelling (e.g. 'enough': /ɪˈnʌf/ and 'though': /ðəʊ/)
  
  Examples:
  
  >>> MiddleEnglishStresser().phonetic_indexing("midel", "SE")
  'M230'
  
  >>> MiddleEnglishStresser().phonetic_indexing("myddle", "SE")
  'M230'
  
  >>> MiddleEnglishStresser().phonetic_indexing("might", "SE")
  'M120'
  
  >>> MiddleEnglishStresser().phonetic_indexing("myghtely", "SE")
  'M123'
docstr_tok: ["The","Soundex","phonetic","indexing","algorithm","adapted","to","ME","phonology",".","Algorithm",":","Let","w","the","original","word","and","W","the","resulting","one","1",")","Capitalize","the","first","letter","of","w","and","append","it","to","W","2",")","Apply","the","following","replacement","rules","p",",","b",",","f",",","v",",","gh","(","non-nasal","fricatives",")","-",">","1","t",",","d",",","s",",","sh",",","z",",","r",",","k",",","g",",","w","(","non-nasal","alveolars","and","velars",")","-",">","2","l","(","alveolar","lateral",")","-",">","3","m",",","n","(","nasals",")","-",">","4","r","(","alveolar","approximant",")","-",">","5","3",")","Concetate","multiple","occurrences","of","numbers","into","one","4",")","Remove","non-numerical","characters","Notes",":","\/h\/","was","thought","to","be","either","a","voiceless","or","velar","fricative","when","occurring","in","the","coda","with","its","most","used","grapheme","being","<","gh",">",".","Those","phonemes","either","disappeared",",","resulting","in","the","lengthening","of","preceding","vowel","clusters",",","or","were","developed","into","\/f\/","as","evident","by","modern","spelling","(","e.g",".","'enough","'",":","\/\u026a\u02c8n\u028cf\/","and","'though","'",":","\/\u00f0\u0259\u028a\/",")","Examples",":",">",">",">","MiddleEnglishStresser","(",")",".phonetic_indexing","(","``","midel","''",",","``","SE","''",")","'M230'",">",">",">","MiddleEnglishStresser","(",")",".phonetic_indexing","(","``","myddle","''",",","``","SE","''",")","'M230'",">",">",">","MiddleEnglishStresser","(",")",".phonetic_indexing","(","``","might","''",",","``","SE","''",")","'M120'",">",">",">","MiddleEnglishStresser","(",")",".phonetic_indexing","(","``","myghtely","''",",","``","SE","''",")","'M123","'"]
code: def _soundex(self, word):
      """
      The Soundex phonetic indexing algorithm adapted to ME phonology.
  
      Algorithm:
  
      Let w the original word and W the resulting one
  
      1) Capitalize the first letter of w and append it to W
  
      2) Apply the following replacement rules
  
          p, b, f, v, gh (non-nasal fricatives) -> 1
  
          t, d, s, sh, z, r, k, g, w (non-nasal alveolars and velars) -> 2
  
          l (alveolar lateral) -> 3
  
          m, n (nasals) -> 4
  
          r (alveolar approximant) -> 5
  
      3) Concetate multiple occurrences of numbers into one
  
      4) Remove non-numerical characters
  
      Notes:
          /h/ was thought to be either a voiceless or velar fricative
      when occurring in the coda with its most used grapheme being <gh>.
      Those phonemes either disappeared, resulting in the lengthening
      of preceding vowel clusters, or were developed into /f/ as evident
      by modern spelling (e.g. 'enough': /ɪˈnʌf/ and 'though': /ðəʊ/)
  
      Examples:
  
      >>> MiddleEnglishStresser().phonetic_indexing("midel", "SE")
      'M230'
  
      >>> MiddleEnglishStresser().phonetic_indexing("myddle", "SE")
      'M230'
  
      >>> MiddleEnglishStresser().phonetic_indexing("might", "SE")
      'M120'
  
      >>> MiddleEnglishStresser().phonetic_indexing("myghtely", "SE")
      'M123'
      """
  
      self.word = word
      word = self.word[1:]
  
      for w, val in zip(dict_SE.keys(), dict_SE.values()):
          word = word.replace(w, val)
  
      # Remove multiple adjacent occurences of digit
      word = re.sub(r"(\d)\1+", r"\1", word)
  
      # Strip remaining letters
      word = re.sub(r"[a-zðþƿ]+", "", word)
  
      # Add trailing zeroes and return
      return (self.word[0].upper() + word + "0" * 3)[:4]
  
file_path: cltk/src/cltk/phonology/enm/stress.py
imports: import re
  from typing import List
  from cltk.phonology.enm.syllabifier import CONSONANTS, DIPHTHONGS, SHORT_VOWELS, TRIPHTHONGS
  from cltk.stem.enm import stem
label_desc: Use image node_id 4 for calling the MiddleEnglishStresser obj's underlying member method code with example usage: obj._soundex(word) and returns: unknown