objc2_foundation/generated/
NSLinguisticTagger.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[cfg(feature = "NSString")]
12pub type NSLinguisticTagScheme = NSString;
13
14extern "C" {
15 #[cfg(feature = "NSString")]
17 pub static NSLinguisticTagSchemeTokenType: &'static NSLinguisticTagScheme;
18}
19
20extern "C" {
21 #[cfg(feature = "NSString")]
23 pub static NSLinguisticTagSchemeLexicalClass: &'static NSLinguisticTagScheme;
24}
25
26extern "C" {
27 #[cfg(feature = "NSString")]
29 pub static NSLinguisticTagSchemeNameType: &'static NSLinguisticTagScheme;
30}
31
32extern "C" {
33 #[cfg(feature = "NSString")]
35 pub static NSLinguisticTagSchemeNameTypeOrLexicalClass: &'static NSLinguisticTagScheme;
36}
37
38extern "C" {
39 #[cfg(feature = "NSString")]
41 pub static NSLinguisticTagSchemeLemma: &'static NSLinguisticTagScheme;
42}
43
44extern "C" {
45 #[cfg(feature = "NSString")]
47 pub static NSLinguisticTagSchemeLanguage: &'static NSLinguisticTagScheme;
48}
49
50extern "C" {
51 #[cfg(feature = "NSString")]
53 pub static NSLinguisticTagSchemeScript: &'static NSLinguisticTagScheme;
54}
55
56#[cfg(feature = "NSString")]
59pub type NSLinguisticTag = NSString;
60
61extern "C" {
62 #[cfg(feature = "NSString")]
64 pub static NSLinguisticTagWord: &'static NSLinguisticTag;
65}
66
67extern "C" {
68 #[cfg(feature = "NSString")]
70 pub static NSLinguisticTagPunctuation: &'static NSLinguisticTag;
71}
72
73extern "C" {
74 #[cfg(feature = "NSString")]
76 pub static NSLinguisticTagWhitespace: &'static NSLinguisticTag;
77}
78
79extern "C" {
80 #[cfg(feature = "NSString")]
82 pub static NSLinguisticTagOther: &'static NSLinguisticTag;
83}
84
85extern "C" {
86 #[cfg(feature = "NSString")]
88 pub static NSLinguisticTagNoun: &'static NSLinguisticTag;
89}
90
91extern "C" {
92 #[cfg(feature = "NSString")]
94 pub static NSLinguisticTagVerb: &'static NSLinguisticTag;
95}
96
97extern "C" {
98 #[cfg(feature = "NSString")]
100 pub static NSLinguisticTagAdjective: &'static NSLinguisticTag;
101}
102
103extern "C" {
104 #[cfg(feature = "NSString")]
106 pub static NSLinguisticTagAdverb: &'static NSLinguisticTag;
107}
108
109extern "C" {
110 #[cfg(feature = "NSString")]
112 pub static NSLinguisticTagPronoun: &'static NSLinguisticTag;
113}
114
115extern "C" {
116 #[cfg(feature = "NSString")]
118 pub static NSLinguisticTagDeterminer: &'static NSLinguisticTag;
119}
120
121extern "C" {
122 #[cfg(feature = "NSString")]
124 pub static NSLinguisticTagParticle: &'static NSLinguisticTag;
125}
126
127extern "C" {
128 #[cfg(feature = "NSString")]
130 pub static NSLinguisticTagPreposition: &'static NSLinguisticTag;
131}
132
133extern "C" {
134 #[cfg(feature = "NSString")]
136 pub static NSLinguisticTagNumber: &'static NSLinguisticTag;
137}
138
139extern "C" {
140 #[cfg(feature = "NSString")]
142 pub static NSLinguisticTagConjunction: &'static NSLinguisticTag;
143}
144
145extern "C" {
146 #[cfg(feature = "NSString")]
148 pub static NSLinguisticTagInterjection: &'static NSLinguisticTag;
149}
150
151extern "C" {
152 #[cfg(feature = "NSString")]
154 pub static NSLinguisticTagClassifier: &'static NSLinguisticTag;
155}
156
157extern "C" {
158 #[cfg(feature = "NSString")]
160 pub static NSLinguisticTagIdiom: &'static NSLinguisticTag;
161}
162
163extern "C" {
164 #[cfg(feature = "NSString")]
166 pub static NSLinguisticTagOtherWord: &'static NSLinguisticTag;
167}
168
169extern "C" {
170 #[cfg(feature = "NSString")]
172 pub static NSLinguisticTagSentenceTerminator: &'static NSLinguisticTag;
173}
174
175extern "C" {
176 #[cfg(feature = "NSString")]
178 pub static NSLinguisticTagOpenQuote: &'static NSLinguisticTag;
179}
180
181extern "C" {
182 #[cfg(feature = "NSString")]
184 pub static NSLinguisticTagCloseQuote: &'static NSLinguisticTag;
185}
186
187extern "C" {
188 #[cfg(feature = "NSString")]
190 pub static NSLinguisticTagOpenParenthesis: &'static NSLinguisticTag;
191}
192
193extern "C" {
194 #[cfg(feature = "NSString")]
196 pub static NSLinguisticTagCloseParenthesis: &'static NSLinguisticTag;
197}
198
199extern "C" {
200 #[cfg(feature = "NSString")]
202 pub static NSLinguisticTagWordJoiner: &'static NSLinguisticTag;
203}
204
205extern "C" {
206 #[cfg(feature = "NSString")]
208 pub static NSLinguisticTagDash: &'static NSLinguisticTag;
209}
210
211extern "C" {
212 #[cfg(feature = "NSString")]
214 pub static NSLinguisticTagOtherPunctuation: &'static NSLinguisticTag;
215}
216
217extern "C" {
218 #[cfg(feature = "NSString")]
220 pub static NSLinguisticTagParagraphBreak: &'static NSLinguisticTag;
221}
222
223extern "C" {
224 #[cfg(feature = "NSString")]
226 pub static NSLinguisticTagOtherWhitespace: &'static NSLinguisticTag;
227}
228
229extern "C" {
230 #[cfg(feature = "NSString")]
232 pub static NSLinguisticTagPersonalName: &'static NSLinguisticTag;
233}
234
235extern "C" {
236 #[cfg(feature = "NSString")]
238 pub static NSLinguisticTagPlaceName: &'static NSLinguisticTag;
239}
240
241extern "C" {
242 #[cfg(feature = "NSString")]
244 pub static NSLinguisticTagOrganizationName: &'static NSLinguisticTag;
245}
246
247#[repr(transparent)]
250#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
251pub struct NSLinguisticTaggerUnit(pub NSInteger);
252impl NSLinguisticTaggerUnit {
253 #[doc(alias = "NSLinguisticTaggerUnitWord")]
254 pub const Word: Self = Self(0);
255 #[doc(alias = "NSLinguisticTaggerUnitSentence")]
256 pub const Sentence: Self = Self(1);
257 #[doc(alias = "NSLinguisticTaggerUnitParagraph")]
258 pub const Paragraph: Self = Self(2);
259 #[doc(alias = "NSLinguisticTaggerUnitDocument")]
260 pub const Document: Self = Self(3);
261}
262
263unsafe impl Encode for NSLinguisticTaggerUnit {
264 const ENCODING: Encoding = NSInteger::ENCODING;
265}
266
267unsafe impl RefEncode for NSLinguisticTaggerUnit {
268 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
269}
270
271#[repr(transparent)]
274#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
275pub struct NSLinguisticTaggerOptions(pub NSUInteger);
276bitflags::bitflags! {
277 impl NSLinguisticTaggerOptions: NSUInteger {
278 #[doc(alias = "NSLinguisticTaggerOmitWords")]
279 const OmitWords = 1<<0;
280 #[doc(alias = "NSLinguisticTaggerOmitPunctuation")]
281 const OmitPunctuation = 1<<1;
282 #[doc(alias = "NSLinguisticTaggerOmitWhitespace")]
283 const OmitWhitespace = 1<<2;
284 #[doc(alias = "NSLinguisticTaggerOmitOther")]
285 const OmitOther = 1<<3;
286 #[doc(alias = "NSLinguisticTaggerJoinNames")]
287 const JoinNames = 1<<4;
288 }
289}
290
291unsafe impl Encode for NSLinguisticTaggerOptions {
292 const ENCODING: Encoding = NSUInteger::ENCODING;
293}
294
295unsafe impl RefEncode for NSLinguisticTaggerOptions {
296 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
297}
298
299extern_class!(
300 #[unsafe(super(NSObject))]
302 #[derive(Debug, PartialEq, Eq, Hash)]
303 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
304 pub struct NSLinguisticTagger;
305);
306
307unsafe impl NSObjectProtocol for NSLinguisticTagger {}
308
309impl NSLinguisticTagger {
310 extern_methods!(
311 #[cfg(all(feature = "NSArray", feature = "NSString"))]
312 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
313 #[unsafe(method(initWithTagSchemes:options:))]
314 #[unsafe(method_family = init)]
315 pub unsafe fn initWithTagSchemes_options(
316 this: Allocated<Self>,
317 tag_schemes: &NSArray<NSLinguisticTagScheme>,
318 opts: NSUInteger,
319 ) -> Retained<Self>;
320
321 #[cfg(all(feature = "NSArray", feature = "NSString"))]
322 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
323 #[unsafe(method(tagSchemes))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn tagSchemes(&self) -> Retained<NSArray<NSLinguisticTagScheme>>;
326
327 #[cfg(feature = "NSString")]
328 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
329 #[unsafe(method(string))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn string(&self) -> Option<Retained<NSString>>;
332
333 #[cfg(feature = "NSString")]
334 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
336 #[unsafe(method(setString:))]
337 #[unsafe(method_family = none)]
338 pub unsafe fn setString(&self, string: Option<&NSString>);
339
340 #[cfg(all(feature = "NSArray", feature = "NSString"))]
341 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
342 #[unsafe(method(availableTagSchemesForUnit:language:))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn availableTagSchemesForUnit_language(
345 unit: NSLinguisticTaggerUnit,
346 language: &NSString,
347 ) -> Retained<NSArray<NSLinguisticTagScheme>>;
348
349 #[cfg(all(feature = "NSArray", feature = "NSString"))]
350 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
351 #[unsafe(method(availableTagSchemesForLanguage:))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn availableTagSchemesForLanguage(
354 language: &NSString,
355 ) -> Retained<NSArray<NSLinguisticTagScheme>>;
356
357 #[cfg(all(feature = "NSOrthography", feature = "NSRange"))]
358 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
359 #[unsafe(method(setOrthography:range:))]
360 #[unsafe(method_family = none)]
361 pub unsafe fn setOrthography_range(
362 &self,
363 orthography: Option<&NSOrthography>,
364 range: NSRange,
365 );
366
367 #[cfg(all(feature = "NSOrthography", feature = "NSRange"))]
368 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
369 #[unsafe(method(orthographyAtIndex:effectiveRange:))]
370 #[unsafe(method_family = none)]
371 pub unsafe fn orthographyAtIndex_effectiveRange(
372 &self,
373 char_index: NSUInteger,
374 effective_range: NSRangePointer,
375 ) -> Option<Retained<NSOrthography>>;
376
377 #[cfg(feature = "NSRange")]
378 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
379 #[unsafe(method(stringEditedInRange:changeInLength:))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn stringEditedInRange_changeInLength(
382 &self,
383 new_range: NSRange,
384 delta: NSInteger,
385 );
386
387 #[cfg(feature = "NSRange")]
388 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
389 #[unsafe(method(tokenRangeAtIndex:unit:))]
390 #[unsafe(method_family = none)]
391 pub unsafe fn tokenRangeAtIndex_unit(
392 &self,
393 char_index: NSUInteger,
394 unit: NSLinguisticTaggerUnit,
395 ) -> NSRange;
396
397 #[cfg(feature = "NSRange")]
398 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
399 #[unsafe(method(sentenceRangeForRange:))]
400 #[unsafe(method_family = none)]
401 pub unsafe fn sentenceRangeForRange(&self, range: NSRange) -> NSRange;
402
403 #[cfg(all(feature = "NSRange", feature = "NSString", feature = "block2"))]
404 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
405 #[unsafe(method(enumerateTagsInRange:unit:scheme:options:usingBlock:))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn enumerateTagsInRange_unit_scheme_options_usingBlock(
408 &self,
409 range: NSRange,
410 unit: NSLinguisticTaggerUnit,
411 scheme: &NSLinguisticTagScheme,
412 options: NSLinguisticTaggerOptions,
413 block: &block2::Block<dyn Fn(*mut NSLinguisticTag, NSRange, NonNull<Bool>) + '_>,
414 );
415
416 #[cfg(all(feature = "NSRange", feature = "NSString"))]
417 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
418 #[unsafe(method(tagAtIndex:unit:scheme:tokenRange:))]
419 #[unsafe(method_family = none)]
420 pub unsafe fn tagAtIndex_unit_scheme_tokenRange(
421 &self,
422 char_index: NSUInteger,
423 unit: NSLinguisticTaggerUnit,
424 scheme: &NSLinguisticTagScheme,
425 token_range: NSRangePointer,
426 ) -> Option<Retained<NSLinguisticTag>>;
427
428 #[cfg(all(
429 feature = "NSArray",
430 feature = "NSRange",
431 feature = "NSString",
432 feature = "NSValue"
433 ))]
434 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
435 #[unsafe(method(tagsInRange:unit:scheme:options:tokenRanges:))]
436 #[unsafe(method_family = none)]
437 pub unsafe fn tagsInRange_unit_scheme_options_tokenRanges(
438 &self,
439 range: NSRange,
440 unit: NSLinguisticTaggerUnit,
441 scheme: &NSLinguisticTagScheme,
442 options: NSLinguisticTaggerOptions,
443 token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
444 ) -> Retained<NSArray<NSLinguisticTag>>;
445
446 #[cfg(all(feature = "NSRange", feature = "NSString", feature = "block2"))]
447 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
448 #[unsafe(method(enumerateTagsInRange:scheme:options:usingBlock:))]
449 #[unsafe(method_family = none)]
450 pub unsafe fn enumerateTagsInRange_scheme_options_usingBlock(
451 &self,
452 range: NSRange,
453 tag_scheme: &NSLinguisticTagScheme,
454 opts: NSLinguisticTaggerOptions,
455 block: &block2::Block<
456 dyn Fn(*mut NSLinguisticTag, NSRange, NSRange, NonNull<Bool>) + '_,
457 >,
458 );
459
460 #[cfg(all(feature = "NSRange", feature = "NSString"))]
461 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
462 #[unsafe(method(tagAtIndex:scheme:tokenRange:sentenceRange:))]
463 #[unsafe(method_family = none)]
464 pub unsafe fn tagAtIndex_scheme_tokenRange_sentenceRange(
465 &self,
466 char_index: NSUInteger,
467 scheme: &NSLinguisticTagScheme,
468 token_range: NSRangePointer,
469 sentence_range: NSRangePointer,
470 ) -> Option<Retained<NSLinguisticTag>>;
471
472 #[cfg(all(
473 feature = "NSArray",
474 feature = "NSRange",
475 feature = "NSString",
476 feature = "NSValue"
477 ))]
478 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
479 #[unsafe(method(tagsInRange:scheme:options:tokenRanges:))]
480 #[unsafe(method_family = none)]
481 pub unsafe fn tagsInRange_scheme_options_tokenRanges(
482 &self,
483 range: NSRange,
484 tag_scheme: &NSString,
485 opts: NSLinguisticTaggerOptions,
486 token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
487 ) -> Retained<NSArray<NSString>>;
488
489 #[cfg(feature = "NSString")]
490 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
491 #[unsafe(method(dominantLanguage))]
492 #[unsafe(method_family = none)]
493 pub unsafe fn dominantLanguage(&self) -> Option<Retained<NSString>>;
494
495 #[cfg(feature = "NSString")]
496 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
497 #[unsafe(method(dominantLanguageForString:))]
498 #[unsafe(method_family = none)]
499 pub unsafe fn dominantLanguageForString(string: &NSString) -> Option<Retained<NSString>>;
500
501 #[cfg(all(feature = "NSOrthography", feature = "NSRange", feature = "NSString"))]
502 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
503 #[unsafe(method(tagForString:atIndex:unit:scheme:orthography:tokenRange:))]
504 #[unsafe(method_family = none)]
505 pub unsafe fn tagForString_atIndex_unit_scheme_orthography_tokenRange(
506 string: &NSString,
507 char_index: NSUInteger,
508 unit: NSLinguisticTaggerUnit,
509 scheme: &NSLinguisticTagScheme,
510 orthography: Option<&NSOrthography>,
511 token_range: NSRangePointer,
512 ) -> Option<Retained<NSLinguisticTag>>;
513
514 #[cfg(all(
515 feature = "NSArray",
516 feature = "NSOrthography",
517 feature = "NSRange",
518 feature = "NSString",
519 feature = "NSValue"
520 ))]
521 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
522 #[unsafe(method(tagsForString:range:unit:scheme:options:orthography:tokenRanges:))]
523 #[unsafe(method_family = none)]
524 pub unsafe fn tagsForString_range_unit_scheme_options_orthography_tokenRanges(
525 string: &NSString,
526 range: NSRange,
527 unit: NSLinguisticTaggerUnit,
528 scheme: &NSLinguisticTagScheme,
529 options: NSLinguisticTaggerOptions,
530 orthography: Option<&NSOrthography>,
531 token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
532 ) -> Retained<NSArray<NSLinguisticTag>>;
533
534 #[cfg(all(
535 feature = "NSOrthography",
536 feature = "NSRange",
537 feature = "NSString",
538 feature = "block2"
539 ))]
540 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
541 #[unsafe(method(enumerateTagsForString:range:unit:scheme:options:orthography:usingBlock:))]
542 #[unsafe(method_family = none)]
543 pub unsafe fn enumerateTagsForString_range_unit_scheme_options_orthography_usingBlock(
544 string: &NSString,
545 range: NSRange,
546 unit: NSLinguisticTaggerUnit,
547 scheme: &NSLinguisticTagScheme,
548 options: NSLinguisticTaggerOptions,
549 orthography: Option<&NSOrthography>,
550 block: &block2::Block<dyn Fn(*mut NSLinguisticTag, NSRange, NonNull<Bool>) + '_>,
551 );
552
553 #[cfg(all(
554 feature = "NSArray",
555 feature = "NSRange",
556 feature = "NSString",
557 feature = "NSValue"
558 ))]
559 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
560 #[unsafe(method(possibleTagsAtIndex:scheme:tokenRange:sentenceRange:scores:))]
561 #[unsafe(method_family = none)]
562 pub unsafe fn possibleTagsAtIndex_scheme_tokenRange_sentenceRange_scores(
563 &self,
564 char_index: NSUInteger,
565 tag_scheme: &NSString,
566 token_range: NSRangePointer,
567 sentence_range: NSRangePointer,
568 scores: Option<&mut Option<Retained<NSArray<NSValue>>>>,
569 ) -> Option<Retained<NSArray<NSString>>>;
570 );
571}
572
573impl NSLinguisticTagger {
575 extern_methods!(
576 #[unsafe(method(init))]
577 #[unsafe(method_family = init)]
578 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
579
580 #[unsafe(method(new))]
581 #[unsafe(method_family = new)]
582 pub unsafe fn new() -> Retained<Self>;
583 );
584}
585
586#[cfg(feature = "NSString")]
588impl NSString {
589 extern_methods!(
590 #[cfg(all(
591 feature = "NSArray",
592 feature = "NSOrthography",
593 feature = "NSRange",
594 feature = "NSValue"
595 ))]
596 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
597 #[unsafe(method(linguisticTagsInRange:scheme:options:orthography:tokenRanges:))]
598 #[unsafe(method_family = none)]
599 pub unsafe fn linguisticTagsInRange_scheme_options_orthography_tokenRanges(
600 &self,
601 range: NSRange,
602 scheme: &NSLinguisticTagScheme,
603 options: NSLinguisticTaggerOptions,
604 orthography: Option<&NSOrthography>,
605 token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
606 ) -> Retained<NSArray<NSLinguisticTag>>;
607
608 #[cfg(all(feature = "NSOrthography", feature = "NSRange", feature = "block2"))]
609 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
610 #[unsafe(method(enumerateLinguisticTagsInRange:scheme:options:orthography:usingBlock:))]
611 #[unsafe(method_family = none)]
612 pub unsafe fn enumerateLinguisticTagsInRange_scheme_options_orthography_usingBlock(
613 &self,
614 range: NSRange,
615 scheme: &NSLinguisticTagScheme,
616 options: NSLinguisticTaggerOptions,
617 orthography: Option<&NSOrthography>,
618 block: &block2::Block<
619 dyn Fn(*mut NSLinguisticTag, NSRange, NSRange, NonNull<Bool>) + '_,
620 >,
621 );
622 );
623}