Home > Perl/CGI, PHP, Programming, Python > Custom Php Script

Custom Php Script

December 22nd, 2009

1). User inputs a text file by browsing it on desktop.

Format of the file is –

Sentence1
Sen2
Sen3
.
.
.
Sen1000

2). User inputs number of files to be split. Example -3 the file is split in 3 parts keeping the formats same.

User inputs “Number of consecutive sentences to be used” == numcon (TO be used later)

3). Begin Article Generation

An article is generated according to two parameters

– Sequential(Files are given names sequentially so first part – part1.txt, second split part – part2.txt, third split part – part3.txt)
– Random(Files are given names randomly so part1.txt can be anyone of them , part2.tx can be anyone of them and so on…)

4). After naming the files.

If numcon is 2 , then randomly 2 consecutive sentences will be taken from “part1.txt” , “part2.txt” and “part3.txt”
All these will be joined/mixed/merged to form a sentence.

eg.

Sen45
Sen46

taken from “part1.txt”

Sen100
Sen101 from “part2.txt”

Sen12
Sen13

taken form “part3.txt”

The resulting article will be

Sen45 Sen46 Sen100 Sen101 Sen12 Sen13

If numcon is 3 then randomly 3 consecutive sentences will be taken from each parts eg.

Sen12
Sen13
Sen14

5). Option to clean generated article of synomymizer

Some words in a sentence of the original will be like this – ["better|firmer|advisable|sounder"]

If user chooses the option to clean synonymizer then – it will have to be output like this –

– first synonym word will be removed … in this case “better”

– From other words a random word will be taken instead of full word so-(if randomly firmer is chosen)

["better|firmer|advisable|sounder"] becomes firmer

5). Option to batch create articles.

User inputs = number of artcles

The script follows steps 3-4 that many times. If “sequential” option is chosen then file split parts need to be named only once. If “random” option chosen then naming of all split parts into “part1.txt”, “part2.txt” etc is to be done everytime an article is generated.

All generated articles can be placed in a text file with each article separated by two blank spaces followed by “===================” and then again two blank spaces. First sentence of the article will be title of the article so ouput should be –

Title 1

Article1

=======

Title2

Article2

=======
.. and so on.


Custom Php Script

Comments are closed.
Bear