From 3828f775cd6aa2061154b0be7096c4e42201371e Mon Sep 17 00:00:00 2001 From: komutan Date: Tue, 7 Jul 2015 02:45:41 +0900 Subject: [PATCH] =?utf8?q?=E5=BE=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/LibNMeCab/Core/CharInfo.cs | 215 ++++++++++++++++++++--------------------- 1 file changed, 107 insertions(+), 108 deletions(-) diff --git a/src/LibNMeCab/Core/CharInfo.cs b/src/LibNMeCab/Core/CharInfo.cs index 55d2394..dfdab57 100644 --- a/src/LibNMeCab/Core/CharInfo.cs +++ b/src/LibNMeCab/Core/CharInfo.cs @@ -1,108 +1,107 @@ -// MeCab -- Yet Another Part-of-Speech and Morphological Analyzer -// -// Copyright(C) 2001-2006 Taku Kudo -// Copyright(C) 2004-2006 Nippon Telegraph and Telephone Corporation -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; - -namespace NMeCab.Core -{ - public struct CharInfo - { - #region Const/Field/Property - - private readonly uint bits; - - /// - /// 互換カテゴリ - /// - public uint Type - { - get { return BitUtils.GetBitField(this.bits, 0, 18); } - } - - /// - /// デフォルトカテゴリ - /// - public uint DefaultType - { - get { return BitUtils.GetBitField(this.bits, 18, 8); } - } - - /// - /// 長さ: 未知語の候補生成方法 - /// - /// - /// 1: 1文字までの文字列を未知語とする - /// 2: 2文字までの文字列を未知語とする - /// ... - /// n: n文字までの文字列を未知語とする - /// - public uint Length - { - get { return BitUtils.GetBitField(this.bits, 18 + 8, 4); } - } - - /// - /// グルーピング: 未知語の候補生成方法 - /// - /// - /// true: 同じ字種でまとめる - /// false: 同じ字種でまとめない - /// - public bool Group - { - get { return BitUtils.GetFlag(this.bits, 18 + 8 + 4); } - } - - /// - /// 動作タイミング - /// そのカテゴリにおいて, いつ未知語処理を動かすか - /// - /// - /// true: 常に未知語処理を動かす - /// false: 既知語がある場合は, 未知語処理を動作させない - /// - public bool Invoke - { - get { return BitUtils.GetFlag(this.bits, 18 + 8 + 4 + 1); } - } - - #endregion - - #region Constractor - - public CharInfo(uint bits) - { - this.bits = bits; - } - - #endregion - - #region Method - - /// - /// 互換カテゴリ判定 - /// - /// - /// - public bool IsKindOf(CharInfo c) - { - return BitUtils.CompareAnd(this.bits, c.bits, 0, 18); - } - - public override string ToString() - { - return string.Format("[Type:{0}][DefaultType:{1}][Length:{2}][Group:{3}][Invoke:{4}]", - this.Type, - this.DefaultType, - this.Length, - this.Group, - this.Invoke); - } - - #endregion - } -} +// MeCab -- Yet Another Part-of-Speech and Morphological Analyzer +// +// Copyright(C) 2001-2006 Taku Kudo +// Copyright(C) 2004-2006 Nippon Telegraph and Telephone Corporation +using System; +using System.Collections.Generic; +using System.Text; + +namespace NMeCab.Core +{ + public struct CharInfo + { + #region Const/Field/Property + + private readonly uint bits; + + /// + /// 互換カテゴリ + /// + public uint Type + { + get { return BitUtils.GetBitField(this.bits, 0, 18); } + } + + /// + /// デフォルトカテゴリ + /// + public uint DefaultType + { + get { return BitUtils.GetBitField(this.bits, 18, 8); } + } + + /// + /// 長さ: 未知語の候補生成方法 + /// + /// + /// 1: 1文字までの文字列を未知語とする + /// 2: 2文字までの文字列を未知語とする + /// ... + /// n: n文字までの文字列を未知語とする + /// + public uint Length + { + get { return BitUtils.GetBitField(this.bits, 18 + 8, 4); } + } + + /// + /// グルーピング: 未知語の候補生成方法 + /// + /// + /// true: 同じ字種でまとめる + /// false: 同じ字種でまとめない + /// + public bool Group + { + get { return BitUtils.GetFlag(this.bits, 18 + 8 + 4); } + } + + /// + /// 動作タイミング + /// そのカテゴリにおいて, いつ未知語処理を動かすか + /// + /// + /// true: 常に未知語処理を動かす + /// false: 既知語がある場合は, 未知語処理を動作させない + /// + public bool Invoke + { + get { return BitUtils.GetFlag(this.bits, 18 + 8 + 4 + 1); } + } + + #endregion + + #region Constractor + + public CharInfo(uint bits) + { + this.bits = bits; + } + + #endregion + + #region Method + + /// + /// 互換カテゴリ判定 + /// + /// + /// + public bool IsKindOf(CharInfo c) + { + return BitUtils.CompareAnd(this.bits, c.bits, 0, 18); + } + + public override string ToString() + { + return string.Format("[Type:{0}][DefaultType:{1}][Length:{2}][Group:{3}][Invoke:{4}]", + this.Type, + this.DefaultType, + this.Length, + this.Group, + this.Invoke); + } + + #endregion + } +} -- 2.11.0