On 2 August 2013 11:52, Hady elsahar <[email protected]> wrote:
>> Scala uses implicit conversions, so instead of the explicit conversion
>> new RichFile(...) you can just import a method that does that
>> conversion and is declared as implicit. In this case,
>> RichReader.wrapReader.
>>
>> You can basically replace the three lines of
>> code above by one import and one statement:
>>
>> import org.dbpedia.extraction.util.RichReader.wrapReader
>>
>> IOUtils.readLines(file) { line =>
>> ...
>> }
>>
>> As another cosmetic change, you could also import IOUtils.readLines:
>>
>> import org.dbpedia.extraction.util.IOUtils.readLines
>> import org.dbpedia.extraction.util.RichReader.wrapReader
>>
>> readLines(file) { line =>
>> ...
>> }
>
>
> done that
> https://github.com/hadyelsahar/extraction-framework/blob/lang-link-extract/scripts/src/main/scala/org/dbpedia/extraction/scripts/LanguageSpecificLinksGenerator.scala
>
> except for in the second option "generating specific files" , i wanted to
> trigger the last line of code so i needed the  method  "hasNext" , so i
> couldn't use readlines defined method in IOUtils
>
>  val inFile = new File(args(1))
>  val inStream= IOUtils.inputStream(inFile)
>  val lines = Source.fromInputStream(inStream).getLines
>
> don't know , maybe we could add this to the functionality of IOUtils , i
> suggest also adding function WriteLine to IOUtils , to use it instead of
> LogtoFile method that i implemented

I'm not sure. What would that method do? Probably just

writer.write(str)
writer.newLine()

Doesn't seem to be enough complexity to warrant the addition of a new method...

>
>
>
>> I just searched for introductions to Scala implicits, and I think this
>> one is pretty good:
>>
>> http://www.artima.com/pins1ed/implicit-conversions-and-parameters.html
>
>
> thanks for the link , it's good
>
>
> thanks
> Regards
>
> -------------------------------------------------
> Hady El-Sahar
> Research Assistant
> Center of Informatics Sciences | Nile University
>

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Dbpedia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-developers

Reply via email to