⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 word.java

📁 基于词典和最大匹配算法的的中文分词组件
💻 JAVA
字号:
/**
 * 
 */
package org.solol.mmseg.internal;

import org.solol.mmseg.core.IWord;

/**
 * @author solo L
 * 
 */
public class Word implements IWord {

	private String value = "";

	private int frequency = 0;

	private int length = 0;
	
	private int type = UNRECOGNIZED;	

	public Word(String value, int type) {
		this.value = value;
		this.type = type;
		this.length = value.length();
	}

	public Word(String value, int frequency, int type) {
		this(value, type);
		this.frequency = frequency;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.solol.mmseg.core.IWord#getLength()
	 */
	public int getLength() {
		return length;
	}

	public boolean equals(Object anObject) {
		if (this == anObject) {
			return true;
		}
		if (anObject instanceof IWord) {
			IWord anotherWord = (IWord) anObject;
			return anotherWord.getValue().equalsIgnoreCase(value);
		}
		return false;
	}

	public int hashCode() {
		return value.hashCode();
	}

	public String getValue() {
		return value;
	}

	public int getFrequency() {
		return frequency;
	}
	
	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -