Instance Method インスタンスメソッド

enumerateTags(in:unit:scheme:options:using:)

Enumerates over a given range of the string for a particular unit and calls the specified block for each tag. 文字列のある与えられた範囲に渡ってある与えられた単位に対して列挙します、そして指定されたブロックを各タグに対して呼び出します。

Declaration 宣言

func enumerateTags(in range: NSRange, 
              unit: NSLinguisticTaggerUnit, 
            scheme: NSLinguisticTagScheme, 
           options: NSLinguisticTagger.Options = [], 
             using block: (NSLinguisticTag?, NSRange, UnsafeMutablePointer<ObjCBool>) -> Void)

Parameters パラメータ

range

The range to analyze. 分析する範囲。

unit

The linguistic unit. For possible values, see NSLinguisticTaggerUnit. 言語学的単位。可能な値として、NSLinguisticTaggerUnitを見てください。

tagScheme

The tag scheme. For possible values, see NSLinguisticTagScheme. タグスキーム。可能な値として、NSLinguisticTagSchemeを見てください。

opts

The linguistic tagger options to use. See NSLinguisticTagger.Options for possible values. 使用する言語学的タガー(標識付け)オプション。NSLinguisticTagger.Optionsを可能な値として見てください。

block

The block to apply to ranges of the string. その文字列の範囲に適用することになるブロック。

The block takes the following arguments: ブロックは以下の引数をとります:

tag

The located linguistic tag. 発見された言語学的タグ。

tokenRange

The range of the linguistic tag. その言語学的タグの範囲。

stop 中止

A reference to a Boolean value. The block can set the value to true to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this Boolean to true within the block. あるブール値への参照。ブロックは、値をtrueに設定することで、それ以上の集合の処理を止めることができます。stop引数は、ひとつの退出専用引数です。あなたは、「ブロック」内でこのブールをtrueに設定できるだけであるべきです。

Discussion 議論

This method’s block is called for all tokens intersecting a given range, supplying tags and ranges. The tagger segments the string into sentences and tokens as necessary, and return those ranges along with a tag for any scheme in its array of tag schemes. For example, if the tag scheme is lexicalClass, the tags specify the part of speech (for word tokens) or the type of whitespace or punctuation (for whitespace or punctuation tokens). If the tag scheme is lemma, the tags specify the stem form of the word (if known) for each word token. このメソッドの持つブロックは、与えられた範囲と交わる全てのトークンに対して、それらタグと範囲を提供して呼び出されます。そのタガーは、文字列を必要に応じて文とトークンに分割します、そしてそれらの範囲を、タグスキームいくらかからなるそれの配列の中の何らかのスキームに対するあるタグと一緒に、返します。例えば、タグスキームがlexicalClassならば、タグは品詞(単語トークンに対して)もしくは空白または句読点の型(空白または句読点トークンに対して)を指定します。タグスキームがlemmaならば、タグは各単語トーキンに対する単語の語幹を(もし知られるならば)指定します。

See Also 参照

Enumerating Linguistic Tags 言語学的タグを列挙する