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 1 commit
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
86 changes: 86 additions & 0 deletions src/NaturalLanguage/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,90 @@ 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 ContextualEmbeddingWithModelIdentifier(string modelIdentifier);
haritha-mohan marked this conversation as resolved.
Show resolved Hide resolved

[Static]
[Export("contextualEmbeddingsForValues:")]
NLContextualEmbedding[] ContextualEmbeddingsForValues(NSDictionary<NSString, NSObject> valuesDictionary);
haritha-mohan marked this conversation as resolved.
Show resolved Hide resolved

[Static]
[Export("contextualEmbeddingWithLanguage:")]
[return: NullAllowed]
NLContextualEmbedding ContextualEmbeddingWithLanguage(string language);
haritha-mohan marked this conversation as resolved.
Show resolved Hide resolved

[Static]
[Export("contextualEmbeddingWithScript:")]
[return: NullAllowed]
NLContextualEmbedding ContextualEmbeddingWithScript(string script);
haritha-mohan marked this conversation as resolved.
Show resolved Hide resolved

[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 EmbeddingResult(string @string, [NullAllowed] string language, [NullAllowed] out NSError error);
haritha-mohan marked this conversation as resolved.
Show resolved Hide resolved

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

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

[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:")]
// [Async]
haritha-mohan marked this conversation as resolved.
Show resolved Hide resolved
void EnumerateTokenVectorsInRange(NSRange range, Action<NSArray<NSNumber>, NSRange, IntPtr> block);
haritha-mohan marked this conversation as resolved.
Show resolved Hide resolved

[Export("tokenVectorAtIndex:tokenRange:")]
[return: NullAllowed]
NSNumber[] TokenVectorAtIndex(nuint characterIndex, IntPtr tokenRange);
haritha-mohan marked this conversation as resolved.
Show resolved Hide resolved
}
}
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
Loading