This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
# weather.pl - | |
# | |
# | |
use strict; | |
use warnings; | |
use utf8; | |
use XML::Simple; | |
binmode STDOUT,":utf8"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object DataImport extends App { | |
val inputDirJa = "../data/sample-data/web/ja" | |
val stopWordJa = "../data/stoplists/jp.txt" | |
val outputFileJa = "data/import_test_ja.mallet" | |
val importer = new ImportJapaneseNoun(new File(stopWordJa)) | |
val instances = importer.readDirectory(new File(inputDirJa)) | |
instances.save(new File(outputFileJa)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.krrrr38.lda | |
case class Token(docId: Int, wordId: Int) | |
case class WordProb(id: Int, prob: Double) | |
object LDA { | |
import java.util.Scanner | |
import java.io.File | |
import java.io.PrintWriter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.krrrr38.bagofwords_en | |
import java.io.File | |
object Bagofwords_ja { | |
def main(args: Array[String]) { | |
val dir = "data" | |
val files = selectDoc(dir) | |
val bagDocs = files.map(new BagDoc(_)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import play.api._ | |
import play.api.mvc._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import models.HatenaDiaryUtil | |
object Application extends Controller { | |
val twitterID = "krrrr38" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// error | |
scala> def f(t: (String, String) => Int) = t(("f1", "f2")) | |
<console>:7: error: not enough arguments for method apply: (v1: String, v2: String)Int in trait Function2. | |
Unspecified value parameter v2. | |
def f(t: (String, String) => Int) = t(("f1", "f2")) | |
// work well ?? | |
scala> def f(t: (String, String) => Int) = t("f1","f2") | |
f: (t: (String, String) => Int)Int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 問1 --- | |
> cat hoge.log | |
--- 問2 --- | |
> cut -d , -f 1,4 hoge.log | |
--- 問3 --- | |
> grep "^server4" hoge.log | |
--- 問4 --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> lazy val ps: Stream[Int] = 2 #:: Stream.from(3).filter(i => ps.takeWhile(j => j*j <= i).forall(i%_ !=0)) | |
ps: Stream[Int] = <lazy> | |
scala> def isPrime(n: Int) = n match{ | |
| case i if i <= 1 => false | |
| case i => ps.takeWhile(j => j*j <= n).forall(i%_ !=0) | |
| } | |
isPrime: (n: Int)Boolean | |
scala> def findSumPrime(ls: List[List[Int]]): Option[List[Int]] = ls.find(l => isPrime(l.sum)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> lazy val ps: Stream[Int] = 2 #:: Stream.from(3).filter(i => ps.takeWhile(j => j*j <= i).forall(i%_ !=0)) | |
ps: Stream[Int] = <lazy> | |
scala> def isPrime(n: Int) = n match{ | |
| case i if i <= 1 => false | |
| case i => ps.takeWhile(j => j*j <= n).forall(i%_ !=0) | |
| } | |
isPrime: (n: Int)Boolean | |
scala> def hasSameElements(ls: List[Int]) = { |