(64位)本体学习程序(ontoEnrich)系统配置说明文档

1系统环境

64位 Ubuntu

2 第三方依赖库配置

  1. boost_1_44_0

    #解压boost_1_44_0.tar.gz 到 /usr/local.如果出现权限问题,请用sudo执行该命令
    tar zxvf boost_1_44_0.tar.gz -C /usr/local
    
    #编译Boost.Regex 
    #检查 echo $BOOST_ROOT 是否等于 /usr/local/boost_1_44_0
    #如果为空,在~/.bashrc 中写入 export BOOST_ROOT = /usr/local/boost_1_44_0
    cd ${BOOST_ROOT}/libs/regex/build/
    #如果当前目录存在名为"gcc"的文件夹,则将之删除
    make -f gcc-shared.mak
    make -f gcc.mak
    cd gcc/
    sudo ln -s libboost_regex-gcc-1_42.so /usr/local/lib
    sudo ln -s libboost_regex-gcc-1_42.so /usr/lib
    
    #重要,指明boost.regex库的链接位置。在.bashrc中写入
    export LD_LIBRARY_PATH=${BOOST_ROOT}/libs/regex/build/gcc
    
    
  2. ltp-service

    cd path_to_ltp-service/__ltpService
    #检查LTPOption.h 中是否为 #define LINUX_OS  //#define WIN_OS
    cd path_to_ltp-service
    chmod +x configure
    ./configure
    make
    sudo make install
    #如果libutil libxml4nlp libservice 在 /usr/local/lib中,则ltp-service配置成功
    
    
  3. 安装mysql

    安装mysql,包括mysql-server,mysql-client,libmysqlclient-dev:

    sudo apt-get install mysql-server 
    sudo apt-get install mysql-client
    sudo apt-get install libmysqlclient-dev

    程序中所用的数据库名为wikipedia,用户名为'root'@'localhost',密码为‘hadoop’。如果用户名root的密码不为hadoop时,注意修改密码。

    创建数据库wikipedia:

    > create database wikipedia;
    > use wikipedia;

    恢复数据:将wikipedia_mysql_backup(里面包含create table语句和insert语句)恢复到wikipedia数据库中:

    > source wikipedia_mysql_backup

3 make源文件

将 {程序路径}\ontoEnrich\system\makefile,用如下的makefile覆盖:

#如果提示文件找不到,添加需要的 INCLUDE,LINK 路径
#修改时,请对比原makefile文件,并不要修改原文件(将原makefile文件备份)
#如果提示文件找不到,添加需要的 INCLUDE,LINK 路径
#修改时,请对比原makefile文件,并不要修改原文件(将原makefile文件备份)
INCLUDE = ./ -I ../segment -I ../conceptRecognise -I ../utility \
      -I ../regexMatch -I ../include -I ../suffixTree -I ../wikiProject \
      -I ../relationExtractor -I ../simWord -I ../clustering -I ../pattern \
      -I /usr/local/include -I /usr/local/boost_1_44_0 
VPATH = ../segment:../conceptRecognise:../utility:../suffixTree \
    :../regexMatch:../wikiProject:../relationExtractor \
    :../simWord:../clustering:../pattern

BOOSTLIBS = -L /usr/local/boost_1_44_0/libs/regex/build/gcc -lboost_regex-gcc-1_42

object1=text.o corpus.o simpleConceptExtractor.o
object2=getRulePattern.o regexMatch.o
object3=wikiCategory.o zh2sim.o connectMysql.o regexMatch.o
object4=CWikiNetworkTrainer.o fire.o CWikiNetwork.o StrFun.o
object5=suffixTree.o charConverter.o
object6=relationPopulation.o mark.o kmeans.o patternUtility.o pattern.o synForest.o
object7=clustering.o wordVector.o distance.o tree.o
object8=getPattern.o editDistanceCal.o patternGenerator.o
object=$(object1) $(object2) $(object3) $(object4) $(object5) $(object6) $(object7) $(object8) \
       wikiInfoExtractor.o wikiInfoExtractor.o conceptRecognizor.o \
       addElement.o ontoLearner.o ontologyEnrichment.o sentParser.o
ontologyEnrichment:$(object)
    g++ -o ontologyEnrichment -g $^ -I$(INCLUDE) -lmysqlclient ${BOOSTLIBS} \
        -L ../segment -lsegment  -L /usr/local/lib -lutil -lxml4nlp -lservice 
myUtility.o:myUtility.cpp
    g++ -g -c $^ -I$(INCLUDE) -L ../segment -lsegment
 
#simpleConceptLearner.o:$(object1) 
#    g++ -g -o simpleConceptLearner.o $^ -L../segment -lsegment
simpleConceptExtractor.o:simpleConceptExtractor.cpp
    g++ -c -g $^ -I$(INCLUDE)
text.o:text.cpp
    g++ -c -g $^ -I$(INCLUDE) -L ../segment -lsegment
corpus.o:corpus.cpp
    g++ -c -g $^ -I$(INCLUDE) -L ../segment -lsegment
 
# getRuleFile.o:$(object2) 
    # g++ -g -o getRuleFile.o $^ -I$(INCLUDE) -L../ -lsegment -lboost_regex-gcc-1_42
getRulePattern.o:getRulePattern.cpp
    g++ -g -c $^ -I$(INCLUDE) 
regexMatch.o:regexMatch.cpp 
    g++ -c -g $^ -I$(INCLUDE) ${BOOSTLIBS}
 
wikiInfoExtractor.o:wikiInfoExtractor.cpp
    g++ -g -c $^ -I$(INCLUDE) ${BOOSTLIBS} -L ../segment -lsegment
 
conceptRecognizor.o:conceptRecognizor.cpp
    g++ -g -c $^ -I$(INCLUDE) -L ../segment -lsegment
 
# cateRel.o:$(object3)
    # g++ -g -o cateRel.o $^  -I$(INCLUDE) -lboost_regex-gcc-1_42 -lmysqlclient -L ../segment -lsegment 
wikiCategory.o:wikiCategory.cpp
    g++ -c -g $^ -I$(INCLUDE) ${BOOSTLIBS} -L ../segment -lsegment
zh2sim.o:zh2sim.cpp
    g++ -g -c $^ -I$(INCLUDE)
connectMysql.o:connectMysql.cpp
    g++ -g -c $^ -I$(INCLUDE) -lmysqlclient
 
addElement.o:addElement.cpp
    g++ -g -c $^ -I$(INCLUDE) -lmysqlclient
ontoLearner.o:ontoLearner.cpp
    g++ -g -c  $^ 
ontologyEnrichment.o:ontologyEnrichment.cpp
    g++ -g -c $^
 
CWikiNetworkTrainer.o: CWikiNetworkTrainer.cpp
    g++ -g -c $^ -I$(INCLUDE)
fire.o :fire.cpp
    g++ -g $^  -c -o fire.o -I$(INCLUDE)
CWikiNetwork.o : CWikiNetwork.cpp
    g++ -g -c $^ -I$(INCLUDE)
StrFun.o: StrFun.cpp
    g++ -g -c $^ -I$(INCLUDE)
 
suffixTree.o:suffixTree.cpp
    g++ -c -g $^ -I$(INCLUDE) -L ../segment -lsegment 
charConverter.o:charConverter.cpp
    g++ -c -g $^
 
relationPopulation.o:relationPopulation.cpp
    g++ -c $^ -I$(INCLUDE)
mark.o:mark.cpp
    g++ -c $^ -I$(INCLUDE)
kmeans.o:kmeans.cpp
    g++ -c $^ -I$(INCLUDE)
patternUtility.o:patternUtility.cpp
    g++ -c $^ -I$(INCLUDE)
pattern.o:pattern.cpp
    g++ -c $^ -I$(INCLUDE) 
synForest.o:synForest.cpp
    g++ -g -c $^ -I$(INCLUDE) -L ../segment -lsegment
 
clustering.o:clustering.cpp
    g++ -c -g $^ -I$(INCLUDE)
wordVector.o:wordVector.cpp
    g++ -c -g $^ -I$(INCLUDE)
distance.o:distance.cpp
    g++ -c -g $^  
tree.o:tree.cpp
    g++ -c -g $^
 
getPattern.o:getPattern.cpp
    g++ -g -c $^ -I$(INCLUDE) ${BOOSTLIBS}
patternGenerator.o:patternGenerator.cpp
    g++ -g -c $^ -I$(INCLUDE) ${BOOSTLIBS}
editDistanceCal.o:editDistanceCal.cpp
    g++ -g -c $^ -I$(INCLUDE)
 
sentParser.o:sentParser.cpp    
    g++ -g -c $^ -I$(INCLUDE)  -L /usr/local/lib -lutil -lxml4nlp -lservice
 
clean:
    rm  $(object) ontologyEnrichment

 

4 生成可执行程序

#若是有已经生成的可执行文件ontologyEnrichment,可以先用make clean命令清理一遍,然后再make
cd ontoEnrich_64/systrm make
运行程序:  ./ontologyEnrichment
posted @ 2015-06-06 17:09  CherishFu  阅读(317)  评论(0编辑  收藏  举报