Skip to content

Instantly share code, notes, and snippets.

@s13731105
s13731105 / Rwordseg.R
Last active June 2, 2016 22:12
用 R 進行中文 text Mining
library(XML)
library(RCurl)
library(tm)
library(tmcn)
library(Rwordseg)
setwd("C:/test")
d.corpus <-Corpus(DirSource("/test/doc"), readerControl = list(language="UTF-8"))
#上兩行為抓取本機文字檔, 餘皆同網路上說明文字
@jeffreyolchovy
jeffreyolchovy / LRUCache.scala
Created August 6, 2012 21:19
LRU cache implementation in Scala
import akka.stm._
import scala.collection.immutable.ListMap
case class LRUCache[A, B](private val MAX_ENTRIES: Int)
{
protected val cache = Ref(ListMap.empty[A, B])
def getOrElse(key: A)(fn: => B): B = {
get(key).getOrElse {
val result = fn