Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- New open source TTF font files - Dictionary words for spanish and english - New dictionary import utility
- Loading branch information
joserodriguezvalderrama
committed
Jun 8, 2008
1 parent
d88c521
commit 9db24aa
Showing
10 changed files
with
362,434 additions
and
155 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/** | ||
* Generate fixed-width dictionary file | ||
* | ||
*/ | ||
|
||
|
||
/** Word lengths */ | ||
$minLength = 5; | ||
$maxLength = 8; | ||
|
||
|
||
|
||
|
||
|
||
if ($argc < 3) { | ||
die("Usage: $argv[0] infile outfile\n"); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
if (!file_exists($argv[1])) { | ||
die("File '$argv[1]' doesn't exists\n"); | ||
} | ||
|
||
|
||
|
||
$fp = fopen($argv[1], "r"); | ||
$fp2 = fopen($argv[2], "w"); | ||
|
||
while ($lin = fgets($fp)) { | ||
$lin = trim(strtolower($lin)); | ||
$strlen = strlen($lin); | ||
if ($strlen>=$minLength && $strlen<=$maxLength && preg_match("/^[a-z]+$/", $lin)) { | ||
$lin = str_pad($lin, $maxLength); | ||
fwrite($fp2, "$lin\n"); | ||
} | ||
} | ||
|
||
fclose($fp); | ||
fclose($fp2); | ||
|
||
|
||
|
||
?> |
Oops, something went wrong.