public static ExtractUrlEntities ( string text ) : IEnumerable |
||
text | string | |
Результат | IEnumerable |
public void ExtractUrlEntities_SurrogatePairTest() { var entity = TweetExtractor.ExtractUrlEntities("🍣 http://example.com/ 🍣").Single(); Assert.Equal(new[] { 2, 21 }, entity.Indices); Assert.Equal("http://example.com/", entity.Url); Assert.Equal("http://example.com/", entity.ExpandedUrl); Assert.Equal("http://example.com/", entity.DisplayUrl); }
public void ExtractUrlEntities_Test() { var entity = TweetExtractor.ExtractUrlEntities("hogehoge http://example.com/").Single(); Assert.Equal(new[] { 9, 28 }, entity.Indices); Assert.Equal("http://example.com/", entity.Url); Assert.Equal("http://example.com/", entity.ExpandedUrl); Assert.Equal("http://example.com/", entity.DisplayUrl); }
public void ExtractUrlEntities_MultipleTest() { var entities = TweetExtractor.ExtractUrlEntities("hogehoge http://aaa.example.com/ http://bbb.example.com/").ToArray(); Assert.Equal(2, entities.Length); Assert.Equal(new[] { 9, 32 }, entities[0].Indices); Assert.Equal("http://aaa.example.com/", entities[0].Url); Assert.Equal(new[] { 33, 56 }, entities[1].Indices); Assert.Equal("http://bbb.example.com/", entities[1].Url); }
public void ExtractUrlEntities_CompositeCharacterTest() { // 合成文字 é ( \u00e9 ) を含むツイート (1文字としてカウントする) // 参照: https://dev.twitter.com/issues/251 var entity = TweetExtractor.ExtractUrlEntities("Caf\u00e9 http://example.com/").Single(); Assert.Equal(new[] { 5, 24 }, entity.Indices); Assert.Equal("http://example.com/", entity.Url); Assert.Equal("http://example.com/", entity.ExpandedUrl); Assert.Equal("http://example.com/", entity.DisplayUrl); }
public void ExtractUrlEntities_CombiningCharacterSequenceTest() { // 結合文字列 é ( e + \u0301 ) を含むツイート (2文字としてカウントする) // 参照: https://dev.twitter.com/issues/251 var entity = TweetExtractor.ExtractUrlEntities("Cafe\u0301 http://example.com/").Single(); Assert.Equal(new[] { 6, 25 }, entity.Indices); Assert.Equal("http://example.com/", entity.Url); Assert.Equal("http://example.com/", entity.ExpandedUrl); Assert.Equal("http://example.com/", entity.DisplayUrl); }