Skip to content

Instantly share code, notes, and snippets.

@yuzu441
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuzu441/91acfc7b2479f628c91d to your computer and use it in GitHub Desktop.
Save yuzu441/91acfc7b2479f628c91d to your computer and use it in GitHub Desktop.
ことえり dictionary to GoogleIME dictionary
<?php
if($argc != 3) {
exit("引数の数が正しくありません".PHP_EOL
."サンプル".PHP_EOL
."php parse.php 辞書データファイル名 出力先ファイル名".PHP_EOL);
}
$xml = simplexml_load_file($argv[1]);
$outputData = "";
foreach($xml->array->dict as $item) {
$line = $item->string[1]."\t"
.$item->string[0]."\t"
."名詞".PHP_EOL;
$outputData = $outputData.$line;
}
file_put_contents("output.txt", $outputData, LOCK_EX);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment