Esempio n. 1
0
        public List <EntityInfo> ExtractEntities(string text)
        {
            var result = new List <EntityInfo>();

            if (!string.IsNullOrEmpty(text))
            {
                UrlExtractor.Extract(text, this.ExtractsUrlWithoutProtocol, this._tldDictionary, this._longestTldLength, this._shortestTldLength, result);
                HashtagExtractor.Extract(text, result);
                MentionExtractor.Extract(text, true, result);
                CashtagExtractor.Extract(text, result);
                RemoveOverlappingEntities(result);
            }
            return(result);
        }
Esempio n. 2
0
        public List <EntityInfo> ExtractHashtags(string text, bool checkUrlOverlap)
        {
            var result = new List <EntityInfo>();

            if (!string.IsNullOrEmpty(text))
            {
                HashtagExtractor.Extract(text, result);

                if (checkUrlOverlap && result.Count > 0)
                {
                    UrlExtractor.Extract(text, this.ExtractsUrlWithoutProtocol, this._tldDictionary, this._longestTldLength, this._shortestTldLength, result);
                    RemoveOverlappingEntities(result);
                    result.RemoveAll(x => x.Type != EntityType.Hashtag);
                }
            }
            return(result);
        }