class_docstr: Syllabifies words based on the Legality Principle and Onset Maximization.
  
      >>> from nltk.tokenize import LegalitySyllableTokenizer
      >>> from nltk import word_tokenize
      >>> from nltk.corpus import words
      >>> text = "This is a wonderful sentence."
      >>> text_words = word_tokenize(text)
      >>> LP = LegalitySyllableTokenizer(words.words())
      >>> [LP.tokenize(word) for word in text_words]
      [['This'], ['is'], ['a'], ['won', 'der', 'ful'], ['sen', 'ten', 'ce'], ['.']]
docstr: Gathers all onsets and then return only those above the frequency threshold
  
  :param words: List of words in a language
  :type words: list(str)
  :return: Set of legal onsets
  :rtype: set(str)
docstr_tok: ["Gathers","all","onsets","and","then","return","only","those","above","the","frequency","threshold",":","param","words",":","List","of","words","in","a","language",":","type","words",":","list","(","str",")",":","return",":","Set","of","legal","onsets",":","rtype",":","set","(","str",")"]
code: def find_legal_onsets(self, words):
      """
      Gathers all onsets and then return only those above the frequency threshold
  
      :param words: List of words in a language
      :type words: list(str)
      :return: Set of legal onsets
      :rtype: set(str)
      """
      onsets = [self.onset(word) for word in words]
      legal_onsets = [
          k
          for k, v in Counter(onsets).items()
          if (v / len(onsets)) > self.legal_frequency_threshold
      ]
      return set(legal_onsets)
  
file_path: nltk/nltk/tokenize/legality_principle.py
imports: from collections import Counter
  from nltk.tokenize.api import TokenizerI
label_desc: Use image node_id 2 for calling the LegalitySyllableTokenizer obj's underlying member method code with example usage: obj.find_legal_onsets(words) and returns: set