本文整理汇总了C#中Annotation类的典型用法代码示例。如果您正苦于以下问题:C# Annotation类的具体用法?C# Annotation怎么用?C# Annotation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Annotation类属于命名空间,在下文中一共展示了Annotation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Analyze
/// <summary>
/// Executes Sentiment and EntitiesMentioned analysis.
/// </summary>
public IOutcome<AnalysisResult> Analyze(StanfordCoreNLP pipeline, string text)
{
//Create annotated document
Annotation doc = new Annotation(text);
pipeline.annotate(doc);
//Validate
var sentences = doc.get(typeof(CoreAnnotations.SentencesAnnotation));
if (sentences == null)
return Outcomes.Outcomes
.Failure<AnalysisResult>()
.WithMessage("No sentences detected.");
//Analyze
var result = new AnalysisResult()
{
Sentiment = GetSentiment((ArrayList)sentences),
MentionedEntities = GetMentions(doc)
};
return Outcomes.Outcomes
.Success<AnalysisResult>()
.WithValue(result);
}
开发者ID:kinetiq,项目名称:Ether.TextAnalysis,代码行数:28,代码来源:SentimentService.cs
示例2: ShowDialog
/// <summary>
/// Prompts the user to edit an annotation.
/// </summary>
public Annotation ShowDialog(Session session, Annotation annotation, string caption)
{
if (caption != null)
{
this.Text = caption;
}
m_session = session;
if (annotation == null)
{
annotation = new Annotation();
annotation.AnnotationTime = DateTime.UtcNow;
annotation.UserName = Environment.GetEnvironmentVariable("USERNAME");
annotation.Message = "<insert your message here>";
}
AnnotationTimeDP.Value = annotation.AnnotationTime;
UserNameTB.Text = annotation.UserName;
CommentTB.Text = annotation.Message;
if (ShowDialog() != DialogResult.OK)
{
return null;
}
annotation = new Annotation();
annotation.AnnotationTime = AnnotationTimeDP.Value;
annotation.UserName = UserNameTB.Text;
annotation.Message = CommentTB.Text;
return annotation;
}
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:36,代码来源:EditAnnotationDlg.cs
示例3: GetInstance
/// <summary>
/// Creates a <c>Parameter</c> using the provided constructor
/// and the XML annotation. The parameter produced contains all
/// information related to the constructor parameter. It knows the
/// name of the XML entity, as well as the type.
/// </summary>
/// <param name="method">
/// this is the constructor the parameter exists in
/// </param>
/// <param name="label">
/// represents the XML annotation for the contact
/// </param>
/// <returns>
/// returns the parameter instantiated for the field
/// </returns>
public Parameter GetInstance(Constructor method, Annotation label, int index) {
Constructor factory = GetConstructor(label);
if(!factory.isAccessible()) {
factory.setAccessible(true);
}
return (Parameter)factory.newInstance(method, label, index);
}
开发者ID:ngallagher,项目名称:simplexml,代码行数:22,代码来源:ParameterFactory.cs
示例4: StanfordCoreNlpDemoThatChangeCurrentDirectory
public void StanfordCoreNlpDemoThatChangeCurrentDirectory()
{
const string Text = "Kosgi Santosh sent an email to Stanford University. He didn't get a reply.";
// Annotation pipeline configuration
var props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
props.setProperty("sutime.binders", "0");
// we should change current directory so StanfordCoreNLP could find all the model files
var curDir = Environment.CurrentDirectory;
Directory.SetCurrentDirectory(Config.JarRoot);
var pipeline = new edu.stanford.nlp.pipeline.StanfordCoreNLP(props);
Directory.SetCurrentDirectory(curDir);
// Annotation
var annotation = new Annotation(Text);
pipeline.annotate(annotation);
// Result - Pretty Print
using (var stream = new ByteArrayOutputStream())
{
pipeline.prettyPrint(annotation, new PrintWriter(stream));
Console.WriteLine(stream.toString());
}
this.CustomAnnotationPrint(annotation);
}
开发者ID:newhbk,项目名称:FSharp.NLP.Stanford,代码行数:28,代码来源:Demo.cs
示例5: AddInnerClassAnnotation
/// <summary>
/// Create an android InnerClass annotation and attach it to the given provider.
/// </summary>
public static void AddInnerClassAnnotation(this IAnnotationProvider provider, string simpleName, AccessFlags accessFlags)
{
var annotation = new Annotation { Type = new ClassReference("dalvik/annotation/InnerClass"), Visibility = AnnotationVisibility.System };
annotation.Arguments.Add(new AnnotationArgument("name", simpleName));
annotation.Arguments.Add(new AnnotationArgument("accessFlags", (int)accessFlags));
provider.Annotations.Add(annotation);
}
开发者ID:jakesays,项目名称:dot42,代码行数:10,代码来源:DexAnnotations.cs
示例6: Main
static void Main()
{
// Path to the folder with models extracted from `stanford-corenlp-3.7.0-models.jar`
var jarRoot = @"..\..\..\..\paket-files\nlp.stanford.edu\stanford-corenlp-full-2016-10-31\models";
// Text for processing
var text = "Kosgi Santosh sent an email to Stanford University. He didn't get a reply.";
// Annotation pipeline configuration
var props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma, parse, ner,dcoref");
props.setProperty("ner.useSUTime", "0");
// We should change current directory, so StanfordCoreNLP could find all the model files automatically
var curDir = Environment.CurrentDirectory;
Directory.SetCurrentDirectory(jarRoot);
var pipeline = new StanfordCoreNLP(props);
Directory.SetCurrentDirectory(curDir);
// Annotation
var annotation = new Annotation(text);
pipeline.annotate(annotation);
// Result - Pretty Print
using (var stream = new ByteArrayOutputStream())
{
pipeline.prettyPrint(annotation, new PrintWriter(stream));
Console.WriteLine(stream.toString());
stream.close();
}
}
开发者ID:sergey-tihon,项目名称:Stanford.NLP.NET,代码行数:31,代码来源:Program.cs
示例7: GetDepencencies
/// <summary>
/// Gets depeendencies from sentence.
/// </summary>
/// <param name="annotation"></param>
/// <returns></returns>
private NotenizerDependencies GetDepencencies(Annotation annotation)
{
Tree tree;
NotenizerDependency dep;
GrammaticalStructure gramStruct;
NotenizerDependencies dependencies;
NotenizerDependency nsubjComplement;
TreebankLanguagePack treeBankLangPack;
java.util.Collection typedDependencies;
GrammaticalStructureFactory gramStructFact;
tree = annotation.get(typeof(TreeCoreAnnotations.TreeAnnotation)) as Tree;
treeBankLangPack = new PennTreebankLanguagePack();
gramStructFact = treeBankLangPack.grammaticalStructureFactory();
gramStruct = gramStructFact.newGrammaticalStructure(tree);
typedDependencies = gramStruct.typedDependenciesCollapsed();
dependencies = new NotenizerDependencies();
foreach (TypedDependency typedDependencyLoop in (typedDependencies as java.util.ArrayList))
{
dep = new NotenizerDependency(typedDependencyLoop);
dependencies.Add(dep);
if (dep.Relation.IsNominalSubject())
{
nsubjComplement = new NotenizerDependency(typedDependencyLoop);
nsubjComplement.TokenType = dep.TokenType == TokenType.Dependent ? TokenType.Governor : TokenType.Dependent;
dependencies.Add(nsubjComplement);
}
}
return dependencies;
}
开发者ID:nemcek,项目名称:notenizer,代码行数:38,代码来源:NotenizerSentence.cs
示例8: GetAnnotationDetail
public static Annotation GetAnnotationDetail(Guid annotationId, SqlDataAccess sda)
{
Annotation returnValue = new Annotation();
try
{
#region | SQL QUERY |
string query = @"SELECT
A.AnnotationId
,A.MimeType
,A.FileName
,A.DocumentBody
FROM
Annotation A
WHERE
A.AnnotationId = '{0}'";
#endregion
DataTable dt = sda.getDataTable(string.Format(query, annotationId));
if (dt != null && dt.Rows.Count > 0)
{
returnValue.AnnotationId = (Guid)dt.Rows[0]["AnnotationId"];
returnValue.MimeType = dt.Rows[0]["MimeType"] != DBNull.Value ? dt.Rows[0]["MimeType"].ToString() : string.Empty;
returnValue.FileName = dt.Rows[0]["FileName"] != DBNull.Value ? dt.Rows[0]["FileName"].ToString() : string.Empty;
returnValue.File = dt.Rows[0]["DocumentBody"] != DBNull.Value ? dt.Rows[0]["DocumentBody"].ToString() : string.Empty;
}
}
catch (Exception)
{
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:32,代码来源:AnnotationHelper.cs
示例9: Create
/// <summary>
/// Create annotations for all included attributes
/// </summary>
public static void Create(AssemblyCompiler compiler, ICustomAttributeProvider attributeProvider,
IAnnotationProvider annotationProvider, DexTargetPackage targetPackage, bool customAttributesOnly = false)
{
if (!attributeProvider.HasCustomAttributes)
return;
var annotations = new List<Annotation>();
foreach (var attr in attributeProvider.CustomAttributes)
{
var attributeType = attr.AttributeType.Resolve();
if (!attributeType.HasIgnoreAttribute())
{
Create(compiler, attr, attributeType, annotations, targetPackage);
}
}
if (annotations.Count > 0)
{
// Create 1 IAttributes annotation
var attrsAnnotation = new Annotation { Visibility = AnnotationVisibility.Runtime };
attrsAnnotation.Type = compiler.GetDot42InternalType("IAttributes").GetClassReference(targetPackage);
attrsAnnotation.Arguments.Add(new AnnotationArgument("Attributes", annotations.ToArray()));
annotationProvider.Annotations.Add(attrsAnnotation);
}
if (!customAttributesOnly)
{
// Add annotations specified using AnnotationAttribute
foreach (var attr in attributeProvider.CustomAttributes.Where(IsAnnotationAttribute))
{
var annotationType = (TypeReference) attr.ConstructorArguments[0].Value;
var annotationClass = annotationType.GetClassReference(targetPackage, compiler.Module);
annotationProvider.Annotations.Add(new Annotation(annotationClass, AnnotationVisibility.Runtime));
}
}
}
开发者ID:jakesays,项目名称:dot42,代码行数:36,代码来源:AnnotationBuilder.cs
示例10: WidgetActions
internal WidgetActions(
Annotation parent,
PdfDirectObject baseObject
)
: base(parent, baseObject)
{
}
开发者ID:n9,项目名称:pdfclown,代码行数:7,代码来源:WidgetActions.cs
示例11: AddToAnnotationCache
private void AddToAnnotationCache(Annotation key)
{
if (_annotCache.ContainsKey(key))
RemoveFromAnnotationCache(key);
_annotCache.Add(key, AnnotationRendererFactory.Default.Create(key));
}
开发者ID:JuliaABurch,项目名称:Treefrog,代码行数:7,代码来源:AnnotationRenderLayer.cs
示例12: VisitAnnotation
protected internal virtual Annotation VisitAnnotation(Annotation annotation)
{
if (annotation == null) return null;
annotation.Declaration = Visit(annotation.Declaration);
annotation.Argument = VisitValue(annotation.Argument);
return annotation;
}
开发者ID:GSerjo,项目名称:capnproto-net,代码行数:8,代码来源:CapnpVisitor.cs
示例13: StoreContentChangedEventArgs
//------------------------------------------------------
//
// Constructors
//
//------------------------------------------------------
#region Constructors
/// <summary>
/// Creates an instance of AnnotationUpdatedEventArgs with the
/// specified action and annotation.
/// </summary>
/// <param name="action">the action that was performed on an annotation</param>
/// <param name="annotation">the annotation that was updated</param>
public StoreContentChangedEventArgs(StoreContentAction action, Annotation annotation)
{
if (annotation == null)
throw new ArgumentNullException("annotation");
_action = action;
_annotation = annotation;
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:22,代码来源:StoreContentChangedEventArgs.cs
示例14: TextBlock
internal TextBlock(int spanStart, int spanEnd, string type, string text, Annotation annotation)
{
mSpanStart = spanStart;
mSpanEnd = spanEnd;
mType = type;
mText = text;
mAnnotation = annotation;
}
开发者ID:project-first,项目名称:latinoworkflows,代码行数:8,代码来源:TextBlock.cs
示例15: AddAnnotation
public void AddAnnotation(Annotation annotation)
{
if (annotation != null)
{
Annotations.Add(annotation);
if (this.AnnotationAdded != null)
this.AnnotationAdded(annotation);
}
}
开发者ID:selfwalker,项目名称:dicom,代码行数:9,代码来源:AnnotationManager.cs
示例16: TestAnnotateAddsToAnnotations
public void TestAnnotateAddsToAnnotations()
{
var support = new AnnotationSupport();
var annotation = new Annotation();
support.Annotate(annotation);
Assert.AreSame(annotation, support.Annotation<Annotation>());
}
开发者ID:ashmind,项目名称:ashmind-code,代码行数:9,代码来源:AnnotationSupportTest.cs
示例17: CreateAnnotations
public override void CreateAnnotations(DexTargetPackage targetPackage)
{
base.CreateAnnotations(targetPackage);
if (Class == null)
return;
bool isBaseTypeGeneric = XType.BaseType != null && (XType.BaseType.IsGenericInstance || XType.BaseType.IsGenericParameter);
bool containsGenericInterfaces = XType.Interfaces.Any(i => i.IsGenericInstance || i.IsGenericParameter);
bool needsFieldAnnotation = !Class.IsSynthetic && Class.Fields.Count(p => !p.IsSynthetic && !p.IsStatic) > 1;
bool needsAnnotation = Class.GenericInstanceFields.Count > 0
|| XType.GenericParameters.Count > 0
|| isBaseTypeGeneric
|| containsGenericInterfaces
|| needsFieldAnnotation;
if (!needsAnnotation) return;
var annType = Compiler.GetDot42InternalType(InternalConstants.TypeReflectionInfoAnnotation).GetClassReference(targetPackage);
var annotation = new Annotation(annType, AnnotationVisibility.Runtime);
if (Class.GenericInstanceFields.Count > 0)
{
annotation.Arguments.Add(new AnnotationArgument(InternalConstants.TypeReflectionInfoGenericArgumentsFields,
Class.GenericInstanceFields.Select(f=>f.Name).ToArray()));
}
if (XType.GenericParameters.Count > 0)
annotation.Arguments.Add(new AnnotationArgument(InternalConstants.TypeReflectionInfoGenericArgumentCountField, XType.GenericParameters.Count));
List<Annotation> definitions= new List<Annotation>();
if (isBaseTypeGeneric)
definitions.Add(AssemblyCompilerExtensions.GetGenericDefinitionAnnotationForType(
XType.BaseType, true, Compiler, targetPackage));
foreach (var intf in XType.Interfaces)
{
if(!intf.IsGenericInstance && !intf.IsGenericParameter)
continue;
definitions.Add(AssemblyCompilerExtensions.GetGenericDefinitionAnnotationForType(
intf, true, Compiler, targetPackage));
}
if(definitions.Count > 0)
annotation.Arguments.Add(new AnnotationArgument(InternalConstants.TypeReflectionInfoGenericDefinitionsField, definitions.ToArray()));
if (needsFieldAnnotation)
{
annotation.Arguments.Add(new AnnotationArgument(InternalConstants.TypeReflectionInfoFieldsField,
Class.Fields.Where(p=>!p.IsSynthetic && !p.IsStatic).Select(p=>p.Name).ToArray()));
}
Class.Annotations.Add(annotation);
}
开发者ID:jakesays,项目名称:dot42,代码行数:56,代码来源:StandardClassBuilder.cs
示例18: ProcessText
public static JObject ProcessText(string text)
{
var annotation = new Annotation(text);
using (java.io.StringWriter writer = new java.io.StringWriter())
{
pipeline.annotate(annotation);
pipeline.jsonPrint(annotation, writer);
return JObject.Parse(writer.toString());
}
}
开发者ID:gbolinder,项目名称:OTAP,代码行数:10,代码来源:NLP.cs
示例19: AnnotationBuilder
private AnnotationBuilder(AnnotationType type, AnnotationSurfaceSize size, Guid toolId, int currentPage)
{
this.surfaceSize = size;
this.type = type;
this.annotation = new Annotation()
{
Type = type,
Points = new List<AnnotationPoint>(),
PageNumber = currentPage,
ToolId = toolId
};
}
开发者ID:reactiveui-forks,项目名称:VirtualSales,代码行数:13,代码来源:AnnotationBuilder.cs
示例20: SendServerSpan
public virtual void SendServerSpan(Span span, int duration)
{
var annotation = new Annotation()
{
Host = zipkinEndpoint.GetEndpoint(serviceName),
Duration = duration, //duration is currently not supported by zipkin UI
Timestamp = GetTimeStamp(),
Value = zipkinCoreConstants.SERVER_SEND
};
span.Annotations.Add(annotation);
spanCollector.Collect(span);
}
开发者ID:theburningmonk,项目名称:Medidata.ZipkinTracerModule,代码行数:14,代码来源:SpanTracer.cs
注:本文中的Annotation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论