docstr: :param text: The text to be transcribed
  :param punctuation: Retain punctuation
  :param with_squared_brackets: if True, add squared bracked around transcription
  
  The algorithm first tries the substitutions defined in
  IPA_rules and IPA.
  
  The following exceptions are considered:
  
  - Geminants are pronounced as long consonants/vowels
  
  - [v ð z] are allophones of the fricatives /f θ s/ between vowels
  - [ŋ] is an allophone of /n/ occurring before /k/ and /ɡ/
  - [ɣ] is an allophone of /g/ after a vowel or liquid
  - /l r/ were velarized when geminated or before a consonant
  - [ç, x]  are allophones of /h/ when occuring in the coda of a syllable and
    preceded by front and back vowels respectively
  
  Examples:
  
  >>> Transcriber().transcribe('Fæder ūre þū þe eeart on heofonum,', punctuation = True)
  '[fæder uːre θuː θe eːɑrˠt on heovonum,]'
  
  >>> Transcriber().transcribe('Hwæt! wē Gār-Dena in ġēar-dagum', punctuation = False)
  '[ʍæt weː gɑːrdenɑ in jæːɑrdɑgum]'
code: def transcribe(
      text: str, punctuation=True, with_squared_brackets=True
  ) -> str:
      """
      :param text: The text to be transcribed
      :param punctuation: Retain punctuation
      :param with_squared_brackets: if True, add squared bracked around transcription
  
      The algorithm first tries the substitutions defined in
      IPA_rules and IPA.
  
      The following exceptions are considered:
  
      - Geminants are pronounced as long consonants/vowels
  
      - [v ð z] are allophones of the fricatives /f θ s/ between vowels
      - [ŋ] is an allophone of /n/ occurring before /k/ and /ɡ/
      - [ɣ] is an allophone of /g/ after a vowel or liquid
      - /l r/ were velarized when geminated or before a consonant
      - [ç, x]  are allophones of /h/ when occuring in the coda of a syllable and
        preceded by front and back vowels respectively
  
      Examples:
  
      >>> Transcriber().transcribe('Fæder ūre þū þe eeart on heofonum,', punctuation = True)
      '[fæder uːre θuː θe eːɑrˠt on heovonum,]'
  
      >>> Transcriber().transcribe('Hwæt! wē Gār-Dena in ġēar-dagum', punctuation = False)
      '[ʍæt weː gɑːrdenɑ in jæːɑrdɑgum]'
      """
  
      if not punctuation:
          text = re.sub(r"[\.\";\,\:\[\]\(\)!&?‘]", "", text)
  
      text = text.lower()
      text = re.sub(r"rr", "rˠ", text)
      text = re.sub(r"(\w)\1", r"\1ː", text)
  
      text = re.sub(r"(?<=[iīæǣeē])h", "ç", text)
      text = re.sub(r"(?<=[aāoōuū])h", "x", text)
  
      text = re.sub(r"r(?=[bcdðfgġhlmnprstwƿxþ])", "rˠ", text)
      text = re.sub(r"l(?=[bcdðfgġhlmnprstwƿxþ])", "ɫ", text)
  
      text = re.sub(
          r"(?<=[aæeiouyǣāēīūōȳ])f(?=[aæeiouyǣāēīūōȳ])", "v", text
      )
      text = re.sub(
          r"(?<=[aæeiouyǣāēīūōȳ])þ(?=[aæeiouyǣāēīūōȳ])", "ð", text
      )
      text = re.sub(
          r"(?<=[aæeiouyǣāēīūōȳ])s(?=[aæeiouyǣāēīūōȳ])", "z", text
      )
  
      for w, val in zip(IPA_rules.keys(), IPA_rules.values()):
          text = text.replace(w, val)
  
      for w, val in zip(IPA.keys(), IPA.values()):
          text = text.replace(w, val)
  
      if with_squared_brackets:
          return "[" + text.replace("-", "") + "]"
      else:
          return text.replace("-", "")
  
file_path: cltk/src/cltk/phonology/ang/transcription.py
imports: import logging
  import re
  import unicodedata
label_desc: Use image node_id 2 for calling the Transcriber obj's underlying member method code with example usage: obj.transcribe(text, punctuation, with_squared_brackets) and returns: unknown, text