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


Java Term.from方法代码示例

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


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

示例1: optimalRoot

import org.ansj.domain.Term; //导入方法依赖的package包/类
/**
 * 取得最优路径的root Term
 * 
 * @return
 */
protected Term optimalRoot() {
	Term to = end;
	to.clearScore();
	Term from = null;
	while ((from = to.from()) != null) {
		for (int i = from.getOffe() + 1; i < to.getOffe(); i++) {
			terms[i] = null;
		}
		if (from.getOffe() > -1) {
			terms[from.getOffe()] = from;
		}
		// 断开横向链表.节省内存
		from.setNext(null);
		from.setTo(to);
		from.clearScore();
		to = from;
	}
	return root;
}
 
开发者ID:Lewis-Liu-001,项目名称:ansj_segx,代码行数:25,代码来源:Graph.java

示例2: optimalRoot

import org.ansj.domain.Term; //导入方法依赖的package包/类
/**
 * 取得最优路径的root Term
 * 
 * @return
 */
protected Term optimalRoot() {
    Term to = end;
    to.clearScore();
    Term from = null;
    while ((from = to.from()) != null) {
        for (int i = from.getOffe() + 1; i < to.getOffe(); i++) {
            terms[i] = null;
        }
        if (from.getOffe() > -1) {
            terms[from.getOffe()] = from;
        }
        // 断开横向链表.节省内存
        from.setNext(null);
        from.setTo(to);
        from.clearScore();
        to = from;
    }
    return root;
}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:25,代码来源:Graph.java

示例3: walkPath

import org.ansj.domain.Term; //导入方法依赖的package包/类
/**
 * 干涉性增加相对权重
 * 
 * @param relationMap
 */
public void walkPath(Map<String, Double> relationMap) {
    Term term = null;
    // BEGIN先行打分
    merger(root, 0, relationMap);
    // 从第一个词开始往后打分
    for (int i = 0; i < terms.length; i++) {
        term = terms[i];
        while (term != null && term.from() != null && term != end) {
            int to = term.toValue();
            merger(term, to, relationMap);
            term = term.next();
        }
    }
    optimalRoot();
}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:21,代码来源:Graph.java

示例4: walkPathByScore

import org.ansj.domain.Term; //导入方法依赖的package包/类
public void walkPathByScore() {
	Term term = null;
	// BEGIN先行打分
	mergerByScore(root, 0);
	// 从第一个词开始往后打分
	for (int i = 0; i < terms.length; i++) {
		term = terms[i];
		while (term != null && term.from() != null && term != end) {
			int to = term.toValue();
			mergerByScore(term, to);
			term = term.getNext();
		}
	}
	optimalRoot();
}
 
开发者ID:Lewis-Liu-001,项目名称:ansj_segx,代码行数:16,代码来源:Graph.java

示例5: walkPath

import org.ansj.domain.Term; //导入方法依赖的package包/类
public void walkPath() {
	Term term = null;
	// BEGIN先行打分
	merger(root, 0);
	// 从第一个词开始往后打分
	for (int i = 0; i < terms.length; i++) {
		term = terms[i];
		while (term != null && term.from() != null && term != end) {
			int to = term.toValue();
			merger(term, to);
			term = term.getNext();
		}
	}
	optimalRoot();
}
 
开发者ID:Lewis-Liu-001,项目名称:ansj_segx,代码行数:16,代码来源:Graph.java

示例6: nameAmbiguity

import org.ansj.domain.Term; //导入方法依赖的package包/类
/**
 * 人名消歧,比如.邓颖超生前->邓颖 超生 前 fix to 丁颖超 生 前! 规则的方式增加如果两个人名之间连接是- , ·,•则连接
 */
public static void nameAmbiguity(Term[] terms) {
	Term from = null;
	Term term = null;
	Term next = null;
	for (int i = 0; i < terms.length - 1; i++) {
		term = terms[i];
		if (term != null && term.termNatures() == TermNatures.NR && term.getName().length() == 2) {
			next = terms[i + 2];
			if (next.termNatures().personAttr.split > 0) {
				term.setName(term.getName() + next.getName().charAt(0));
				terms[i + 2] = null;
				terms[i + 3] = new Term(next.getName().substring(1), next.getOffe(), TermNatures.NW);
				TermUtil.termLink(term, terms[i + 3]);
				TermUtil.termLink(terms[i + 3], next.to());
			}
		}
	}

	// 外国人名修正
	for (int i = 0; i < terms.length; i++) {
		term = terms[i];
		if (term != null && term.getName().length() == 1 && i > 0 && WordAlert.CharCover(term.getName().charAt(0)) == '·') {
			from = term.from();
			next = term.to();

			if (from.natrue().natureStr.startsWith("nr") && next.natrue().natureStr.startsWith("nr")) {
				from.setName(from.getName() + term.getName() + next.getName());
				TermUtil.termLink(from, next.to());
				terms[i] = null;
				terms[i + 1] = null;
			}
		}
	}

}
 
开发者ID:Lewis-Liu-001,项目名称:ansj_segx,代码行数:39,代码来源:NameFix.java

示例7: walkPathByScore

import org.ansj.domain.Term; //导入方法依赖的package包/类
public void walkPathByScore() {
    Term term = null;
    // BEGIN先行打分
    mergerByScore(root, 0);
    // 从第一个词开始往后打分
    for (int i = 0; i < terms.length; i++) {
        term = terms[i];
        while (term != null && term.from() != null && term != end) {
            int to = term.toValue();
            mergerByScore(term, to);
            term = term.next();
        }
    }
    optimalRoot();
}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:16,代码来源:Graph.java

示例8: nameAmbiguity

import org.ansj.domain.Term; //导入方法依赖的package包/类
/**
 * 人名消歧,比如.邓颖超生前->邓颖 超生 前 fix to 丁颖超 生 前! 规则的方式增加如果两个人名之间连接是- , ·,•则连接
 */
public static void nameAmbiguity(Term[] terms, Forest... forests) {
    Term from = null;
    Term term = null;
    Term next = null;
    for (int i = 0; i < terms.length - 1; i++) {
        term = terms[i];
        if (term != null && term.termNatures() == TermNatures.NR && term.getName().length() == 2) {
            next = terms[i + 2];
            if (next.termNatures().personAttr.split > 0) {
                term.setName(term.getName() + next.getName().charAt(0));
                terms[i + 2] = null;

                String name = next.getName().substring(1);
                terms[i + 3] = new Term(name, next.getOffe() + 1,
                                new NatureRecognition(forests).getTermNatures(name));
                TermUtil.termLink(term, terms[i + 3]);
                TermUtil.termLink(terms[i + 3], next.to());
            }
        }
    }

    // 外国人名修正
    for (int i = 0; i < terms.length; i++) {
        term = terms[i];
        if (term != null && term.getName().length() == 1 && i > 0
                        && WordAlert.CharCover(term.getName().charAt(0)) == '·') {
            from = term.from();
            next = term.to();

            if (from.natrue().natureStr.startsWith("nr") && next.natrue().natureStr.startsWith("nr")) {
                from.setName(from.getName() + term.getName() + next.getName());
                TermUtil.termLink(from, next.to());
                terms[i] = null;
                terms[i + 1] = null;
            }
        }
    }

}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:43,代码来源:NameFix.java


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