当前位置: 首页>>代码示例>>C#>>正文


C# Lucene.TermText方法代码示例

本文整理汇总了C#中Lucene.TermText方法的典型用法代码示例。如果您正苦于以下问题:C# Lucene.TermText方法的具体用法?C# Lucene.TermText怎么用?C# Lucene.TermText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lucene的用法示例。


在下文中一共展示了Lucene.TermText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessEmailToken

		private void ProcessEmailToken (Lucene.Net.Analysis.Token token)
		{
			token_type = tokentype_email;

			string email = token.TermText ();
			parts = email.Split (replace_array);
			if (parts.Length == 1) // safety check
				return;

			int index_at = email.IndexOf ('@');
			// store username part as a large token
			// and also remove the final tld part
			Array.Copy (parts, 0, parts, 1, parts.Length - 1);
			parts [0] = email.Substring (0, index_at);
#if ENABLE_RDF_ADAPTER
			if (link_call_back != null)
				link_call_back ("mailto://" + email, true);
#endif
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:19,代码来源:NoiseFilter.cs

示例2: ProcessURLToken

		private void ProcessURLToken (Lucene.Net.Analysis.Token token)
		{
			token_type = tokentype_host;

			string hostname = token.TermText ();
			parts = hostname.Split ('.');

			if (parts [0] != "www")
				return;

			// remove initial www
			Array.Copy (parts, 1, parts, 0, parts.Length - 1);
			Array.Resize (ref parts, parts.Length - 1);
			// FIXME: Remove final tld
			// Any string of form "<alnum> '.')+<alnum>" has type HOST
			// Removing last token might remove important words from non-host
			// string of that form. To fix that, we need to match against the
			// huge list of TLDs.
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:19,代码来源:NoiseFilter.cs

示例3: ProcessToken

		private bool ProcessToken (ref Lucene.Net.Analysis.Token token)
		{
			string type = token.Type ();

			if (type == tokentype_number) {
				// nobody will remember more than 20 digits
				return (token.TermText ().Length <= 20);
			} else if (type == tokentype_alphanum) {
				string text = token.TermText ();
				int begin = 0;
				bool found = false;
				// Check if number, in that case strip 0's from beginning
				foreach (char c in text) {
					if (! Char.IsDigit (c)) {
						begin = 0;
						break;
					} else if (! found) {
						if (c == '0')
							begin ++;
						else
							found = true;
					}
				}

				if (begin == 0)
					return ! IsNoise (text);
				token = new Lucene.Net.Analysis.Token (
					text.Remove (0, begin),
					begin,
					token.EndOffset (),
					type);
				return true;
			} else if (type == tokentype_email) {
				if (tokenize_email_hostname)
					ProcessEmailToken (token);
				return true;
			} else if (type == tokentype_host) {
				if (tokenize_email_hostname)
					ProcessURLToken (token);
				return true;
			} else
				// FIXME: Noise should be only tested on token type alphanum
				return ! IsNoise (token.TermText ());
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:44,代码来源:NoiseFilter.cs


注:本文中的Lucene.TermText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。