/// <summary> /// Gets all tokens from a dictionary as isolated nodes. /// </summary> /// <typeparam name="TNode">The type of nodes that <paramref name="bundle"/> is for.</typeparam> /// <param name="bundle">The dictionary bundle containing <paramref name="dictionary"/>.</param> /// <param name="dictionary">The dictionary to get nodes from.</param> /// <returns>Iteration of nodes.</returns> /// <remarks> /// Iterating over all nodes may require some significant time, depending on the size of the dictionary. Please be careful. /// </remarks> public static IEnumerable <TNode> GetNodes <TNode>(this DictionaryBundle <TNode> bundle, MeCabDictionary dictionary) where TNode : MeCabNodeBase <TNode> { var address = GetSafeMemoryMappedViewAddress(dictionary); ulong token_table_starts; ulong token_table_ends; GetTokenTableLocations(address, out token_table_starts, out token_table_ends); for (ulong t = token_table_starts; t < token_table_ends; t += 16) { var node = bundle.NodeAllocator(); LoadNodeData(t, node); node.Feature = GetFeature(t, bundle, dictionary); node.Stat = MeCabNodeStat.Nor; yield return(node); } }