<commit_before>package edu.isi.karma.rep.semantictypes;

import org.json.JSONException;
import org.json.JSONWriter;

import edu.isi.karma.util.Jsonizable;

public class SemanticType implements Jsonizable{
	private final String hNodeId;
	private final String type;
	private final String domain;
	private final Origin origin;
	
	public enum Origin {
		User, CRFModel
	}
	
	public SemanticType(String hNodeId, String type, Origin origin) {
		this.hNodeId = hNodeId;
		this.type = type;
		this.origin = origin;
		this.domain = "";
	}

	public SemanticType(String hNodeId, String type, String domain, Origin origin) {
		this.hNodeId = hNodeId;
		this.type = type;
		this.origin = origin;
		this.domain = domain;
	}

	public String getHNodeId() {
		return hNodeId;
	}

	public String getType() {
		return type;
	}
	
	public String getDomain() {
		return domain;
	}
	
	public Origin getOrigin() {
		return origin;
	}

	@Override
	public void write(JSONWriter writer) throws JSONException {
		writer.object();
		writer.key("HNodeId").value(hNodeId);
		writer.key("Type").value(type);
		writer.key("Origin").value(origin.name());
		writer.endObject();
	}
}<commit_msg>Updating semantictypes/SemanticType.java to latest revision ...<commit_after>package edu.isi.karma.rep.semantictypes;

import org.json.JSONException;
import org.json.JSONWriter;

import edu.isi.karma.util.Jsonizable;

public class SemanticType implements Jsonizable {
	private final String hNodeId;
	private final String type;
	private final String domain;
	private final Origin origin;
	private final ConfidenceLevel confidenceLevel;

	public enum Origin {
		User, CRFModel
	}

	public enum ConfidenceLevel {
		High, Medium, Low
	}

	public SemanticType(String hNodeId, String type, Origin origin, Double probability) {
		this.hNodeId = hNodeId;
		this.type = type;
		this.origin = origin;
		this.domain = "";
		
		if(probability > 0.8)
			confidenceLevel = ConfidenceLevel.High;
		else if (probability < 0.8 && probability > 0.4)
			confidenceLevel = ConfidenceLevel.Medium;
		else
			confidenceLevel = ConfidenceLevel.Low;
	}
	
	public SemanticType(String hNodeId, String type, String domain, Origin origin, Double probability) {
		this.hNodeId = hNodeId;
		this.type = type;
		this.origin = origin;
		this.domain = domain;
		
		if(probability > 0.8)
			confidenceLevel = ConfidenceLevel.High;
		else if (probability < 0.8 && probability > 0.4)
			confidenceLevel = ConfidenceLevel.Medium;
		else
			confidenceLevel = ConfidenceLevel.Low;
	}

	public String getHNodeId() {
		return hNodeId;
	}

	public String getType() {
		return type;
	}

	public Origin getOrigin() {
		return origin;
	}

	public ConfidenceLevel getConfidenceLevel() {
		return confidenceLevel;
	}

	@Override
	public void write(JSONWriter writer) throws JSONException {
		writer.object();
		writer.key("HNodeId").value(hNodeId);
		writer.key("Type").value(type);
		writer.key("Origin").value(origin.name());
		writer.key("ConfidenceLevel").value(confidenceLevel.name());
		writer.endObject();
	}
}

{'fraction_non_alphanumeric': 0.1075907590759076, 'fraction_numerical': 0.0039603960396039604, 'mean_word_length': 4.262152777777778, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '677660', 'n_tokens_mistral': 1063, 'n_tokens_neox': 957, 'n_words': 244}