ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

Text Parsing and Output ( Result in Excel, load multiple DOC,RTF,Word Files )

<< < (2/8) > >>

Krishean:
Here's everything that was detected as a reaction:


--- --->cscript /nologo script.js
Name: "NOZIPHO"
Line: "(RIRE...........................)"
Type: "reaction"
Name: "AUNTIE"
Line: "\"
Type: "reaction"
Name: "FISTOS"
Line: "\"
Type: "reaction"
Name: "CASPER"
Line: "(sifflant.....)"
Type: "reaction"
Name: "CASPER"
Line: "(sifflant.....)"
Type: "reaction"
Name: "CASPER"
Line: "(rire.......)"
Type: "reaction"
Name: "CASPER"
Line: "(REAC)"
Type: "reaction"
Name: "CASPER"
Line: "(reac............................................................)"
Type: "reaction"
Name: "CASPER"
Line: "(REAC)"
Type: "reaction"
Name: "FISTOS"
Line: "(reac)"
Type: "reaction"
Name: "AUNTIE"
Line: "(reac.......)"
Type: "reaction"
Name: "NOZIPHO"
Line: "(reac.....................)"
Type: "reaction"
Name: "AUNTIE"
Line: "\"
Type: "reaction"
Name: "AUNTIE"
Line: "(reac)"
Type: "reaction"
Name: "AUNTIE"
Line: "(rire)."
Type: "reaction"
Name: "FISTOS"
Line: "(BISOUS)"
Type: "reaction"
Name: "MMATSIETSI"
Line: "(rire.............................)"
Type: "reaction"
Name: "JIMMY"
Line: "(Tu n'as pas ‚t‚ invit‚,)"
Type: "reaction"
Name: "CASPER"
Line: "(rire........)"
Type: "reaction"
Name: "CASPER"
Line: "(rire................)"
Type: "reaction"
Name: "CASPER"
Line: "(rire............................)"
Type: "reaction"
Name: "FISTOS"
Line: "\"
Type: "reaction"
Name: "THOMAS"
Line: "(tchip)"
Type: "reaction"
Name: "FISTOS"
Line: "(reac)"
Type: "reaction"
Name: "FISTOS"
Line: "(reac)"
Type: "reaction"
Name: "NOZIPHO"
Line: "(rire)"
Type: "reaction"
Name: "CASPER"
Line: "(siffle)"
Type: "reaction"
Name: "CASPER"
Line: "(rire..)"
Type: "reaction"
Name: "CASPER"
Line: "(rire)"
Type: "reaction"
Name: "FISTOS"
Line: "(reac)"
Type: "reaction"
Name: "FISTOS"
Line: "(rire)"
Type: "reaction"
Name: "CASPER"
Line: "(rire.......)"
Type: "reaction"
Name: "CASPER"
Line: "(reac.............................)"
Type: "reaction"
Name: "CASPER"
Line: "(reac.....................)"
Type: "reaction"
Name: "JIMMY"
Line: "(rire)"
Type: "reaction"
Name: "MALE TEACHER"
Line: "(reac)"
Type: "reaction"
Name: "CASPER"
Line: "\"
Type: "reaction"
Name: "MMATSIETSI"
Line: "(rire....................................)"
Type: "reaction"
Name: "AUNTIE"
Line: "/"
Type: "reaction"
Name: "CASPER"
Line: "(rire...)"
Type: "reaction"
Name: "ALL"
Line: "(rires...)"
Type: "reaction"
Name: "AUNTIE"
Line: "(rire)"
Type: "reaction"
Name: "NOZIPHO"
Line: "\"
Type: "reaction"
Name: "MODISE"
Line: "(reac)"
Type: "reaction"
Name: "CASPER"
Line: "(rire)"
Type: "reaction"
Name: "FISTOS"
Line: "(rire..........)"
Type: "reaction"
Name: "CASPER"
Line: "(rire.........................)"
Type: "reaction"
Name: "CASPER"
Line: "(rire.............) hein ?"
Type: "reaction"
Name: "FISTOS"
Line: "(Elle chante super bien)"
Type: "reaction"
Name: "CASPER"
Line: "(rire......)"
Type: "reaction"
Name: "CASPER"
Line: "/"
Type: "reaction"
Name: "CASPER"
Line: "(reac)"
Type: "reaction"
Name: "CASPER"
Line: "(reac)"
Type: "reaction"
Name: "MODISE"
Line: "(rire...)"
Type: "reaction"
Name: "REVEREND SEROTE"
Line: "/"
Type: "reaction"
Name: "CHOIR CONDUCTOR"
Line: "(rire)"
Type: "reaction"
Name: "CASPER"
Line: "(singing.............................................................)"
Type: "reaction"
Name: "FISTOS"
Line: "(chant discret...............)"
Type: "reaction"
Name: "AMB FILLES"
Line: "(rires....................)"
Type: "reaction"
Name: "AMB FILLES"
Line: "(rires...........................................)"
Type: "reaction"
Name: "CASPER"
Line: "(Plus prŠs)"
Type: "reaction"
Name: "CASPER"
Line: "(rire...)"
Type: "reaction"
Name: "CASPER"
Line: "(reac)"
Type: "reaction"
Name: "CASPER"
Line: "(Plus prŠs..."
Type: "reaction"
Name: "FISTOS"
Line: "(rire)"
Type: "reaction"
Name: "CASPER"
Line: "(rire.......................................)"
Type: "reaction"
Name: "CASPER"
Line: "(Plus prŠs)"
Type: "reaction"
Name: "CASPER"
Line: "(rire)"
Type: "reaction"
Name: "CASPER"
Line: "(tchip)"
Type: "reaction"
Name: "CASPER"
Line: "(rire)"
Type: "reaction"
>Exit code: 0

And I have not yet written the code to generate statistics and output the csv file, but I will try to make it match the image you posted as closely as possible.

Saira:
ok Sure . but if you have other csv forat inwhuch every thing will look ok
thn its ok too

TaoPhoenix:
Just a word of support, I like charts and numbers, that's a beautiful graphic of something I never thought of! (Number of lines per actor/character per episode).

Krishean:
Here's the code so far, I probably won't have much time to work on it until the end of the week. To get it running I recommend opening it with SciTE: http://prdownloads.sourceforge.net/scintilla/Sc304.exe you will also need LibreOffice installed.


--- Code: Javascript ---function echo(a){return WScript.Echo(a);}function exit(a){return WScript.Quit(a);} var fso=WScript.CreateObject('Scripting.FileSystemObject');var wshell=WScript.CreateObject('WScript.Shell'); exit(main());function main(){        // delete old convert.bat if it exists        if(fso.FileExists('convert.bat'))fso.DeleteFile('convert.bat',true);        var bat='@echo off\r\n'+                'set soffice=%ProgramFiles(x86)%\\LibreOffice\\program\\soffice.exe\r\n'+                'for /f "delims=*" %%a in (\'dir /b *.rtf,*.doc,*.docx\') do (\r\n'+                '    "%soffice%" --headless --convert-to txt:Text --outdir "tempfiles" "%%a"\r\n'+                ')\r\ndel %0\r\n@exit\r\n';        // create new convert.bat        file_put_contents('convert.bat',bat);        // run convert.bat, it should delete itself once it has finished        echo('Converting files, please wait...');        wshell.Run('convert.bat',0,true);        echo('Done converting files, processing...');        echo('----------');        // get all files in the tempfiles directory        var files=new Enumerator(fso.GetFolder('tempfiles').Files);        // step through the files and process each of them        for(files.moveFirst();!files.atEnd();files.moveNext()){                var file=fso.GetFile(files.item());                process(file.ParentFolder+'\\'+file.name);        }        echo('----------');        echo('Done processing, exiting.');        return 0;} function process(file){        var arr=safe_split(file_get_contents(file));        for(var i=2;i<arr.length;i++){ // skip first two lines, they are a header                arr[i]=trim(arr[i]);                if(arr[i].length>0&& // test for and exclude blank items                    !(/^\d+$/).test(arr[i])&& // test for and exclude items that are only numbers                    !(/^\(.*\)$/).test(arr[i])){ // test for and exclude items starting with ( and ending with )                        var t=arr[i].split('\t'); // split the item into name and line                        if(t.length==2){                                var name=trim(t[0]),line=trim(t[1]),type='dialogue';                                // check for reaction lines                                if(line.length>0&&                                    ((/^\([^\)]*\)\.?$/).test(line)||line=='\\' || line=='/'))                                        type='reaction';                                //if(type=='reaction')                                        echo('Name: "'+name+'"\n\tLine: "'+line+'"\n\tType: "'+type+'"');                        }else echo("Error: Line may have more than one tab character!");                }        }} function file_get_contents(filename){        var ptr=fso.OpenTextFile(filename,1,false);        var str=new String(ptr.ReadAll());        ptr.Close();        return str;} function file_put_contents(filename,data){        var ptr=fso.CreateTextFile(filename,true);        ptr.Write(data);        ptr.Close();        return;} function safe_split(s){return s.replace(/\r\n/g,'\n').replace(/\r/g,'\n').split('\n');}function trim(s){return s.replace(/^[\s\t\r\n]+/,'').replace(/[\s\t\r\n]+$/,'');} function csv_escape_field(){} function print_r(){        }

Saira:
Csv export functions are left
and the part that keeps the stats
but it does parse the scripts and converts them to text using LibreOffice

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version