- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
<?php
$z=0;
$ti=0;
$ti2=0;
$res=array();
$txt="";
$res=array();
if($argc<2)exit(0);
$fn=$argv[1];
$pt='/(^|\b|\s)((\w|[а-я]|\d)+(?:\.|\,)?)(\b|\.|,|-)/i';
if(isset($fn)){
$fc=file($fn);
foreach($fc as $nl=>$str){
preg_match_all($pt,$str,$res,PREG_PATTERN_ORDER);
foreach($res[0] as $key=>$per){
# $per=trim($per);
$sz=iconv_strlen($per);
$tz=iconv_strlen($per);
echo "Per $per key $key sz $sz\n";
while($sz>=2){
$eb = substr($per,0,$sz-1);
echo "eb $eb\n";
$res=system("cat -b dict.txt | grep ' ".$eb." ' | head -n1 | gawk '{ print $1 }'");
#echo "$res\n";
if($res!=""){
echo "res $res\n";
$oc=substr($per,$sz-1,$tz);
$fd=fopen("$argv[1].txt","a");
if($fd<0){echo "fopen";exit(0);};
fseek($fd,SEEK_END,0);
fwrite($fd,"$res$oc ");
fclose($fd);
$sz=1;
sleep(3);
};
$sz--;
};
if($sz==1){
$fd=fopen("$argv[1].txt","a");
if($fd<0){echo "fopen";exit(0);};
fseek($fd,SEEK_END,0);
fwrite($fd,"$per ");
fclose($fd);
};
};
};
$str="";
$res="";
}
?>
Int 25.03.2011 12:32 # +1
wvxvw 25.03.2011 17:24 # 0
AliceGoth 25.03.2011 22:45 # 0
wvxvw 25.03.2011 23:38 # 0
TarasB 25.03.2011 17:32 # −3
bugmenot 26.03.2011 00:07 # +1
TarasB 26.03.2011 12:19 # 0