Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NaturalLanguage] Add support for Xcode 15 #19039

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions src/NaturalLanguage/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,88 @@ public enum NLTagScheme {
[Field ("NLTagSchemeSentimentScore")]
SentimentScore,
}

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
public enum NLScript {
[Field ("NLScriptUndetermined")]
Undetermined,
[Field ("NLScriptArabic")]
Arabic,
[Field ("NLScriptArmenian")]
Armenian,
[Field ("NLScriptBengali")]
Bengali,
[Field ("NLScriptCanadianAboriginalSyllabics")]
CanadianAboriginalSyllabics,
[Field ("NLScriptCherokee")]
Cherokee,
[Field ("NLScriptCyrillic")]
Cyrillic,
[Field ("NLScriptDevanagari")]
Devanagari,
[Field ("NLScriptEthiopic")]
Ethiopic,
[Field ("NLScriptGeorgian")]
Georgian,
[Field ("NLScriptGreek")]
Greek,
[Field ("NLScriptGujarati")]
Gujarati,
[Field ("NLScriptGurmukhi")]
Gurmukhi,
[Field ("NLScriptHebrew")]
Hebrew,
[Field ("NLScriptJapanese")]
Japanese,
[Field ("NLScriptKannada")]
Kannada,
[Field ("NLScriptKhmer")]
Khmer,
[Field ("NLScriptKorean")]
Korean,
[Field ("NLScriptLao")]
Lao,
[Field ("NLScriptLatin")]
Latin,
[Field ("NLScriptMalayalam")]
Malayalam,
[Field ("NLScriptMongolian")]
Mongolian,
[Field ("NLScriptMyanmar")]
Myanmar,
[Field ("NLScriptOriya")]
Oriya,
[Field ("NLScriptSimplifiedChinese")]
SimplifiedChinese,
[Field ("NLScriptSinhala")]
Sinhala,
[Field ("NLScriptTamil")]
Tamil,
[Field ("NLScriptTelugu")]
Telugu,
[Field ("NLScriptThai")]
Thai,
[Field ("NLScriptTibetan")]
Tibetan,
[Field ("NLScriptTraditionalChinese")]
TraditionalChinese,
}

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Native]
public enum NLContextualEmbeddingAssetsResult : long {
Available,
NotAvailable,
Error,
}

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
public enum NLContextualEmebeddingKey {
[Field ("NLContextualEmbeddingKeyLanguages")]
Languages,
[Field ("NLContextualEmbeddingKeyScripts")]
Scripts,
[Field ("NLContextualEmbeddingKeyRevision")]
Revision,
}
}
83 changes: 83 additions & 0 deletions src/naturallanguage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,4 +651,87 @@ interface NLGazetteer {
[Wrap ("Write (dictionary.GetDictionary ()!, language.HasValue ? language.Value.GetConstant () : null, url, out error)")]
bool Write (NLStrongDictionary dictionary, NLLanguage? language, NSUrl url, [NullAllowed] out NSError error);
}

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface NLContextualEmbedding {
[Static]
[Export ("contextualEmbeddingWithModelIdentifier:")]
[return: NullAllowed]
NLContextualEmbedding CreateWithModelIdentifier (string modelIdentifier);

[Static]
[Export ("contextualEmbeddingsForValues:")]
NLContextualEmbedding [] Create (NSDictionary<NSString, NSObject> values);

[Static]
[Export ("contextualEmbeddingWithLanguage:")]
[return: NullAllowed]
NLContextualEmbedding CreateWithLanguage (string language);

[Static]
[Export ("contextualEmbeddingWithScript:")]
[return: NullAllowed]
NLContextualEmbedding CreateWithScript (string script);

[Export ("modelIdentifier")]
string ModelIdentifier { get; }

[Export ("languages", ArgumentSemantic.Copy)]
string [] Languages { get; }

[Export ("scripts", ArgumentSemantic.Copy)]
string [] Scripts { get; }

[Export ("revision")]
nuint Revision { get; }

[Export ("dimension")]
nuint Dimension { get; }

[Export ("maximumSequenceLength")]
nuint MaximumSequenceLength { get; }

[Export ("loadWithError:")]
bool Load ([NullAllowed] out NSError error);

[Export ("unload")]
void Unload ();

[Export ("embeddingResultForString:language:error:")]
[return: NullAllowed]
NLContextualEmbeddingResult GetEmbeddingResult (string @string, [NullAllowed] string language, [NullAllowed] out NSError error);

[Export ("hasAvailableAssets")]
bool HasAvailableAssets { get; }

[Export ("requestEmbeddingAssetsWithCompletionHandler:")]
[Async]
void RequestAssets (Action<NLContextualEmbeddingAssetsResult, NSError> completionHandler);
}

delegate void TokenVectorEnumeratorHandler (NSArray<NSNumber> tokenVector, NSRange tokenRange, out bool stop);

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface NLContextualEmbeddingResult {
[Export ("string")]
string String { get; }

[Export ("language")]
string Language { get; }

[Export ("sequenceLength")]
nuint SequenceLength { get; }

[Export ("enumerateTokenVectorsInRange:usingBlock:")]
void EnumerateTokenVectors (NSRange range, TokenVectorEnumeratorHandler enumerationHandler);

[return: BindAs (typeof (nuint []))]
[Export ("tokenVectorAtIndex:tokenRange:")]
[return: NullAllowed]
NSNumber [] GetVector (nuint characterIndex, ref NSRange tokenRange);
}
}
57 changes: 0 additions & 57 deletions tests/xtro-sharpie/api-annotations-dotnet/iOS-NaturalLanguage.todo

This file was deleted.

This file was deleted.

This file was deleted.

Loading