示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CalaisDotNet"/> class.
        /// </summary>
        /// <param name="apiKey">The API key.</param>
        /// <param name="content">The content.</param>
        /// <param name="inputFormat">Format of the input content.</param>
        /// <param name="baseUrl">Base URL to be put in rel-tag microformats.</param>
        /// <param name="allowDistribution">if set to <c>true</c> Indicates whether the extracted metadata can be distributed.</param>
        /// <param name="allowSearch">if set to <c>true</c> Indicates whether future searches can be performed on the extracted metadata.</param>
        /// <param name="externalId">User-generated ID for the submission.</param>
        /// <param name="submitter">Identifier for the content submitter.</param>
        /// <param name="enableMetadataType">if set to <c>true</c> Indicates whether the output (RDF only) will include Generic Relation extractions.</param>
        /// <param name="calculateRelevanceScore">if set to <c>true</c> Indicates whether the extracted metadata will include relevance score for each unique entity.</param>
        public CalaisDotNet(string apiKey, string content, CalaisInputFormat inputFormat, string baseUrl, bool allowDistribution, bool allowSearch, string externalId, string submitter, bool enableMetadataType, bool calculateRelevanceScore)
        {
            //Contract
            this.Require(x => apiKey.Length == 24, new ArgumentException("API Key must be 24 characters long (yours was" + apiKey.Length + ")"));
            this.Require(x => !string.IsNullOrEmpty(content), new ArgumentException("Content cannot be empty"));

            // initialise inputs required to call web service
            ApiKey                  = apiKey;
            Content                 = content;
            InputFormat             = inputFormat;
            OutputFormat            = CalaisOutputFormat.Simple;
            BaseUrl                 = baseUrl;
            AllowDistribution       = allowDistribution;
            AllowSearch             = allowSearch;
            ExternalId              = externalId;
            Submitter               = submitter;
            CalculateRelevanceScore = calculateRelevanceScore;
            EnableMetadataType      = string.Empty;

            if (enableMetadataType)
            {
                EnableMetadataType = "GenericRelations";
            }

            // create a new web service proxy to Calais
            _webServiceProxy = new CalaisServiceProxy();
        }
示例#2
0
 public CalaisDotNet(string apiKey, string content, CalaisInputFormat inputFormat, string baseUrl) : this(apiKey, content, inputFormat, baseUrl, true, true, string.Empty, string.Empty, false, true)
 {
 }