예제 #1
0
        /// <summary>
        /// Builds a list of dictionary index files for the specified Part of Speech (POS)
        /// </summary>
        /// <param name="type">The POS to return the index of</param>
        /// <returns>A list of dictionary file paths is successfull; otherwise an empty list</returns>
        internal static List<string> GetIndexForType( DbPartOfSpeechType type )
        {
            List<string> retVal = new List<string>();

            if ( type == DbPartOfSpeechType.All )
            {
                retVal.Add( GetDbIndexPath( DbPartOfSpeechType.Adj ) );
                retVal.Add( GetDbIndexPath( DbPartOfSpeechType.Adv ) );
                retVal.Add( GetDbIndexPath( DbPartOfSpeechType.Noun ) );
                retVal.Add( GetDbIndexPath( DbPartOfSpeechType.Verb ) );
            }
            else
            {
                retVal.Add( GetDbIndexPath( type ) );
            }

            return retVal;
        }
예제 #2
0
 /// <summary>
 /// Determines if the specified database file represents the specified part of speech.
 /// </summary>
 /// <param name="dbFileName">The full path to the database file</param>
 /// <param name="type">The part of speech to check for</param>
 /// <returns>True is the file represents the part of speech; otherwise false</returns>
 private static bool AssertDatabaseType( string dbFileName, DbPartOfSpeechType type )
 {
     string strType = Path.GetExtension( dbFileName );
     strType = strType.Substring( 1, strType.Length - 1 );
     return ( strType.ToLower() == type.ToString().ToLower() );
 }
예제 #3
0
 /// <summary>
 /// Builds the expected dictionary index file for the specified Part of Speech (POS)
 /// </summary>
 /// <param name="type">The POS to build the path for</param>
 /// <returns>The expected dictionary index file</returns>
 private static string GetDbIndexPath( DbPartOfSpeechType type )
 {
     return GetDbFilePath( DbType.Index, type );
 }
예제 #4
0
 /// <summary>
 /// Builds the expected database file path
 /// </summary>
 /// <param name="db">The type of database file</param>
 /// <param name="pos">The part of speech</param>
 /// <returns>The expected database file path</returns>
 private static string GetDbFilePath( DbType db, DbPartOfSpeechType pos )
 {
     string filePath = System.Web.HttpContext.Current.Server.MapPath("~/Resources/Dictionary");
     filePath = Path.Combine( filePath, string.Format( "{0}.{1}", db, pos ) );
     return filePath;
 }
예제 #5
0
 /// <summary>
 /// Builds the expected dictionary data file for the specified Part of Speech (POS)
 /// </summary>
 /// <param name="type">The POS to build the path for</param>
 /// <returns>The expected dictionary data file</returns>
 private static string GetDbDataPath( DbPartOfSpeechType type )
 {
     return GetDbFilePath( DbType.Data, type );
 }