|
Участник форума
Регистрация: 19.02.2008
Сообщений: 186
Провел на форуме: 584540
Репутация:
96
|
|
С этим вопросом разобрался! Спасибо.
Но ребя добить не получается никак  Помогите плз.
Вообще суть такая, есть текстовой документ с таким текстом:
Код:
abandon v. 1 give up or over, yield, surrender, leave, cede, let go,
deliver (up), turn over, relinquish: I can see no reason why we
should abandon the house to thieves and vandals. 2 depart from,
leave, desert, quit, go away from: The order was given to
abandon ship. 3 desert, forsake, jilt, walk out on: He even
abandoned his fianc‚e. 4 give up, renounce; discontinue, forgo,
drop, desist, abstain from: She abandoned cigarettes and whisky
after the doctor's warning.
--n. 5 recklessness, intemperance, wantonness, lack of
restraint, unrestraint: He behaved with wild abandon after he
received the inheritance.
abandoned adj. 1 left alone, forlorn, forsaken, deserted, neglected;
rejected, shunned, cast off or aside, jilted, dropped, outcast:
An abandoned infant was found on the church steps. Totally
alone, she felt abandoned by her friends. 2 bad, immoral,
amoral, wicked, sinful, evil, corrupt, unprincipled,
unrestrained, uninhibited, reprobate; loose, wanton, debauched,
wild, dissolute, dissipated, profligate; depraved, lewd,
lascivious, flagitious: His abandoned behaviour soon landed him
in jail.
abbreviate
v. 1 shorten, compress, contract, truncate, trim, reduce,
curtail: We abbreviated some of the longer words to save space.
2 shorten, cut, condense, abridge, abstract, digest, epitomize,
summarize, US synopsize: The school presented an abbreviated
version of A Midsummer Night's Dream.
abbreviated
adj. skimpy, brief, revealing: The dancers' abbreviated
costumes shocked some members of the audience.
abbreviation
n. initialism; acronym; shortening, contraction: UK is one
kind of abbreviation, or initialism; NATO, which is pronounced
as a word, is another, usually called an acronym.
abdicate v. give up, renounce, disclaim, waive, disown, surrender,
yield, relinquish, abandon, resign, quit: He abdicated all
responsibility for care of the children. She abdicated the
throne to marry a commoner.
abduct v. kidnap, carry off, make away or off with, seize, Slang US
snatch, grab: The child that was abducted is safe.
abet v. 1 encourage, urge, instigate, incite, provoke, egg on, prod,
goad; aid, help, assist: The jury found that his wife had
abetted him in the murder. 2 countenance, approve (of),
support, endorse, second, sanction, condone; further, advance,
promote, uphold: By failing to inform on the terrorists, the
neighbours abetted the bombing.
abeyance n. in abeyance. pending, abeyant, reserved, in reserve,
shelved, pushed or shoved or shunted aside, postponed, put off,
suspended, US tabled; temporarily inactive, dormant; latent;
Colloq in a holding pattern, on the back burner; Slang on hold,
in the deep-freeze, on the shelf, on ice, hanging fire: Legal
proceedings were held in abeyance so that talks could take place
to reach an out-of-court settlement.
abhor v. hate, loathe, detest, abominate, execrate; regard or view
with horror or dread or fright or repugnance or loathing or
disgust, shudder at, recoil or shrink from; be or stand aghast
at: He said that he abhorred any violation of human rights.
abhorrent adj. hateful, detestable, abhorred, abominable, contemptible,
odious, loathsome, horrid, heinous, execrable, repugnant;
repulsive, repellent, revolting, offensive, disgusting,
horrifying, obnoxious: The idea of war was totally abhorrent to
her.
и т.д.
Нужно сделать что бы было так:
abhorrent|hateful|detestable и т.д.
т.е. убрать из текста все числа, удалить все словечки типа adj. v. и т.п.
Удалить все примеры (начинаются или с : или с . заканчиваются .).
Вот мои наброски:
Код:
open(TXT,"file.txt");
open(ST,">result.txt");
@all=<TXT>;
close(TXT);
$string=join($string,@all);
$string=~s/v\.|adj\.|n\.//ig;
$string=~s/\d//ig;
$string=~s/,|;/|/ig;
$string=~s/:[^\.]+\.//g;
$string=~s/\.(.*)\.//g;
@new=$string;
foreach (@new){
$_=~s/ {2,}/|/g; #Удаление пробелов
$_=~s/ //g; #Удаление пробелов
$_ .= "\n"; #Установка символа переноса строки
print ST $_; #Запись в файл
}
close(ST);
Но работает хреновенько  . Кто действительно поможет, получит небольшое денежное вознагрождение и + !
Всем спасибо заранее
Последний раз редактировалось $p01nt; 24.11.2008 в 18:43..
|