zoukankan      html  css  js  c++  java
  • brat安装部署

    1、下载、解压brat

    https://github.com/nlplab/brat/releases/tag/v1.3p1

    tar xzf brat-v1.3_Crunchy_Frog.tar.gz

    2、系统安装httpd

    centos6 

    开启httpd:service httpd start

    重启httpd:service httpd restart

    关闭httpd:service httpd stop

    3、进入brat目录,执行安装

    ./install.sh

    安装过程中会提示输入用户名、密码、邮箱信息,用户名和密码用于web浏览器用户登录。

    4、添加用户

    找到brat/config.py 对应的行,增加:

    USER_PASSWORD = {
    'admn': 'admin',
    'test': 'test',
    # (add USERNAME:PASSWORD pairs below this line.)
    }

    4、配置支持中文

    vim /var/www/html/brat/server/src/projectconfig.py

    找到n  = re.sub(r'[^a-zA-Z0-9_-]', '_', n)这一行并修改:

    n = re.sub(u'[^a-zA-Zu4e00-u9fa5<>,0-9_-]', '_', n)

    5、增加测试文件

    在data/目录新建hero测试目录,然后在hero目录里面新建文档test1.txt,test2.txt,test3.txt,随便写点内容进去,然后在brat目录下执行命令:

    find data -name '*.txt' | sed -e 's|.txt|.ann|g' | xargs touch

    6、开启服务

    在centos中启动 brat :cd brat-v1.3_Crunchy_Frog 运行python standalone.py

    7、在web中访问

    http://192.168.2.190:8001/index.xhtml

    备注:

     在data目录下创建diag目录,此目录下添加配置文件,annotation.conf文件为实体和关系对应的英文名称,visual.conf为实体和关系对应的中文名称

    kwz目录为kwz标注人员分配的标注文件,里面是.txt和.ann文件

    下面贴出具体的配置文件内容

    annotation.conf

    # Simple text-based definitions of hierarchial ontologies of 
    # (physical) entity types, relation types, event types, and
    # attributes.
    
    # This is a minimal example configuration, based (loosely) on some
    # ACE'05 entity, relation and event definitions
    # (http://projects.ldc.upenn.edu/ace/annotation/2005Tasks.html).
    # Please edit this according to the needs of your annotation.
    
    [entities]
    
    # Definition of entities.
    
    # Format is a simple list with one type per line.
    
    ThemeDisease
    ThemeOperation
    ICD
    --------------------
    DiagnosticBasisSymptom
    DiagnosticBasisRiskFactors
    DiagnosticBasisExamination
    DiagnosticBasisExaminationResult
    DifferentialDiagnoses
    --------------------
    StandardTimeOfHospitalization
    NecessaryExaminationAdmission
    OptionalExaminationAdmission
    DrugForTreatment
    Treatment
    IndicationForTreatment
    ContraindicationForTreatment
    --------------------
    Complications
    DrugBeforeTreatment
    MeasureBeforeTreatment
    ExaminationBeforeTreatment
    --------------------
    !AboutOperation
            OperationName
            DataOfOperation
            AnesthesiaMode
            DrugDuringOperation
            SurgicalApproach
            InstrumentUsedInOperation
            InstrumentIntoBody
            BloodTransfusionDuringOperation
    ExaminationDuringTreatment
    DrugAfterTreatment
    MeasureAfterTreatment
    ExaminationAfterTreatment
    --------------------
    InformedConsent
    --------------------
    Delete
    
    [relations]
    # Definition of (binary) relations.
    # Format in brief: one relation per line, with first space-separated
    # field giving the relation type and the rest of the line the
    # comma-separated arguments in ROLE:TYPE format. The roles are
    # typically "Arg1" and "Arg2".
    #Located            Arg1:Person, Arg2:GPE
    #Geographical_part  Arg1:GPE,    Arg2:GPE
    #Family             Arg1:Person, Arg2:Person
    #Employment         Arg1:Person, Arg2:GPE
    #Ownership          Arg1:Person, Arg2:Organization
    #Origin             Arg1:Organization, Arg2:GPE
    #Alias              Arg1:Person, Arg2:Person, <REL-TYPE>:symmetric-transitive
    
    DiagnosticBasisExaminationDiagnosticBasisExaminationResult Arg1:DiagnosticBasisExamination,Arg2:DiagnosticBasisExaminationResult
    IndicationForTreatmentTreatment Arg1:IndicationForTreatment,Arg2:Treatment
    IndicationForTreatmentDrugForTreatment Arg1:IndicationForTreatment,Arg2:DrugForTreatment
    IndicationForTreatmentDrugBeforeTreatment Arg1:IndicationForTreatment,Arg2:DrugBeforeTreatment
    IndicationForTreatmentMeasureBeforeTreatment Arg1:IndicationForTreatment,Arg2:MeasureBeforeTreatment
    IndicationForTreatmentDrugAfterTreatment Arg1:IndicationForTreatment,Arg2:DrugAfterTreatment
    IndicationForTreatmentMeasureAfterTreatment Arg1:IndicationForTreatment,Arg2:MeasureAfterTreatment
    IndicationForTreatmentOperationName Arg1:IndicationForTreatment,Arg2:OperationName
    DrugForTreatmentClassItemDrugForTreatment Arg1:DrugForTreatment,Arg2:DrugForTreatment
    ComplicationsTreatment Arg1:Complications,Arg2:Treatment
    ComplicationsDrugForTreatment Arg1:Complications,Arg2:DrugForTreatment
    ComplicationsDrugBeforeTreatment Arg1:Complications,Arg2:DrugBeforeTreatment
    ComplicationsMeasureBeforeTreatment Arg1:Complications,Arg2:MeasureBeforeTreatment
    ComplicationsDrugAfterTreatment Arg1:Complications,Arg2:DrugAfterTreatment
    ComplicationsMeasureAfterTreatment Arg1:Complications,Arg2:MeasureAfterTreatment
    ThemeDiseaseDiagnosticBasisSymptom Arg1:ThemeDisease,Arg2:DiagnosticBasisSymptom
    ThemeDiseaseDiagnosticBasisRiskFactors Arg1:ThemeDisease,Arg2:DiagnosticBasisRiskFactors
    ThemeDiseaseDiagnosticBasisExamination Arg1:ThemeDisease,Arg2:DiagnosticBasisExamination
    ThemeDiseaseDiagnosticBasisExaminationResult Arg1:ThemeDisease,Arg2:DiagnosticBasisExaminationResult
    ThemeDiseaseDifferentialDiagnoses Arg1:ThemeDisease,Arg2:DifferentialDiagnoses
    ContraindicationForTreatmentTreatment Arg1:ContraindicationForTreatment,Arg2:Treatment
    ContraindicationForTreatmentDrugForTreatment Arg1:ContraindicationForTreatment,Arg2:DrugForTreatment
    ContraindicationForTreatmentDrugBeforeTreatment Arg1:ContraindicationForTreatment,Arg2:DrugBeforeTreatment
    ContraindicationForTreatmentMeasureBeforeTreatment Arg1:ContraindicationForTreatment,Arg2:MeasureBeforeTreatment
    ContraindicationForTreatmentDrugAfterTreatment Arg1:ContraindicationForTreatment,Arg2:DrugAfterTreatment
    ContraindicationForTreatmentMeasureAfterTreatment Arg1:ContraindicationForTreatment,Arg2:MeasureAfterTreatment
    ContraindicationForTreatmentOperationName Arg1:ContraindicationForTreatment,Arg2:OperationName
    ThemeDiseaseICD Arg1:ThemeDisease,Arg2:ICD
    ThemeOperationICD Arg1:ThemeOperation,Arg2:ICD
    
    [events]
    # Definition of events.
    # Format in brief: one event per line, with first space-separated
    # field giving the event type and the rest of the line the
    # comma-separated arguments in ROLE:TYPE format. Arguments may be
    # specified as either optional (by appending "?" to role) or repeated
    # (by appending either "*" for "0 or more" or "+" for "1 or more").
    
    # this is a macro definition, used for brevity
    <POG>=Person|Organization|GPE
    
    # the "!" before a type specifies that it cannot be used for annotation
    # (hierarchy structure only.)
    
    # !Life
    #       Be-born   Person-Arg:Person, Place-Arg?:GPE
    #       Marry     Person-Arg{2}:Person, Place-Arg?:GPE
    #       Divorce   Person-Arg{2}:Person, Place-Arg?:GPE
    #       Die       Person-Arg:Person, Agent-Arg?:<POG>, Place-Arg?:GPE
    # Report Reporter-Arg:<POG>, Event-Arg:<EVENT>
    
    [attributes]
    
    # Definition of entity and event attributes.
    
    # Format in brief: first tab-separated field is attribute name, second
    # a set of key-value pairs. The latter must define "Arg:" which
    # specifies what the attribute can attach to (typically "<EVENT>").
    # If no other keys are defined, the attribute is binary (present or
    # absent). If "Value:" with multiple alternatives is defined, the
    # attribute can have one of the given values.
    
    Individual   Arg:<ENTITY>
    Mention      Arg:<ENTITY>, Value:Name|Nominal|Other
    
    Negation     Arg:<EVENT>
    Confidence   Arg:<EVENT>, Value:High|Neutral|Low

    visual.conf:

    # -*- Mode: Text; tab- 8; indent-tabs-mode: nil; coding: utf-8; -*-
    # vim:set ft=conf ts=2 sw=2 sts=2 autoindent:
    
    [labels]
    
    # Label definitions for display. The labels are separated by pipe
    # characters "|".
    
    # The first label must correspond to the form found first in other
    # configuration files. As this form must be valid for use in e.g. the
    # BioNLP ST standoff format, it must have only ASCII alphanumerics,
    # "_" or "-" (i.e. match '^[a-zA-Z0-9_-]$').
    
    # Labels other than the first define forms that are presented to the
    # user in the annotation interface, with the first form being the
    # preferred full form and the others abbreviations that will be used
    # if fuller forms do not fit in the given space. These have no format
    # restrictions and can contain e.g. space (this tends to make the
    # first and second columns identical for most terms, which do not
    # contain space). Surrounding space is ignored.
    
    
    ### Entity types
    
    #Person | Person
    #Organization | Organization | Org
    #GPE | Geo-political entity | GPE
    
    ThemeDisease | 临床路径适用疾病
    ThemeOperation | 临床路径适用手术或操作
    ICD | ICD编码
    DiagnosticBasisSymptom | 诊断依据临床表现
    DiagnosticBasisRiskFactors | 诊断依据危险因素
    DiagnosticBasisExamination | 诊断相关检查
    DiagnosticBasisExaminationResult | 诊断依据检查结果
    DifferentialDiagnoses | 鉴别诊断
    StandardTimeOfHospitalization | 标准住院日
    NecessaryExaminationAdmission | 入院必需检查
    OptionalExaminationAdmission | 入院可选检查
    DrugForTreatment | 治疗药物
    Treatment | 治疗方式
    IndicationForTreatment | 治疗适应症
    ContraindicationForTreatment | 治疗禁忌症
    Complications | 需要处理的并发症
    DrugBeforeTreatment | 治疗前药物
    MeasureBeforeTreatment | 治疗前处置
    ExaminationBeforeTreatment | 治疗前检查
    AboutOperation | 手术相关
    OperationName | 手术名称
    DataOfOperation | 手术日
    AnesthesiaMode | 麻醉方式
    DrugDuringOperation | 术中用药
    SurgicalApproach | 手术入路
    InstrumentUsedInOperation | 使用的器械或耗材
    InstrumentIntoBody | 植介入器械
    BloodTransfusionDuringOperation | 手术输血情况
    ExaminationDuringTreatment | 治疗中检查或监测
    DrugAfterTreatment | 治疗后药物
    MeasureAfterTreatment | 治疗后处置
    ExaminationAfterTreatment | 治疗后检查
    InformedConsent | 必要的知情同意文书
    Delete | 删除重复文档
    
    
    ### Event types
    
    Be-born | Be born
    Transfer-ownership | Transfer ownership
    Transfer-money | Transfer money
    Start-org | Start org
    Merge-org | Merge org
    End-org | End org
    
    ### Relation types
    Geographical_part | Geographical part | Geo part
    Employment | Employment | Employ
    
    DiagnosticBasisExaminationDiagnosticBasisExaminationResult | 诊断相关检查-诊断依据检查结果
    IndicationForTreatmentTreatment | 治疗适应症-治疗方式
    IndicationForTreatmentDrugForTreatment | 治疗适应症-治疗药物
    IndicationForTreatmentDrugBeforeTreatment | 治疗适应症-治疗前药物
    IndicationForTreatmentMeasureBeforeTreatment | 治疗适应症-治疗前处置
    IndicationForTreatmentDrugAfterTreatment | 治疗适应症-治疗后药物
    IndicationForTreatmentMeasureAfterTreatment | 治疗适应症-治疗后处置
    IndicationForTreatmentOperationName | 治疗适应症-手术名称
    DrugForTreatmentClassItemDrugForTreatment | 治疗药物-大类-细项-治疗药物
    ComplicationsTreatment | 治疗适应症-治疗方式
    ComplicationsDrugForTreatment | 治疗适应症-治疗药物
    ComplicationsDrugBeforeTreatment | 需要处理的并发症-治疗前药物
    ComplicationsMeasureBeforeTreatment | 需要处理的并发症-治疗前处置
    ComplicationsDrugAfterTreatment | 需要处理的并发症-治疗后药物
    ComplicationsMeasureAfterTreatment | 需要处理的并发症-治疗后处置
    ThemeDiseaseDiagnosticBasisSymptom | 临床路径适用疾病-诊断依据临床表现
    ThemeDiseaseDiagnosticBasisRiskFactors | 临床路径适用疾病-诊断依据危险因素
    ThemeDiseaseDiagnosticBasisExamination | 临床路径适用疾病-诊断相关检查
    ThemeDiseaseDiagnosticBasisExaminationResult | 临床路径适用疾病-诊断依据检查结果
    ThemeDiseaseDifferentialDiagnoses | 临床路径适用疾病-鉴别诊断
    ContraindicationForTreatmentTreatment | 治疗禁忌症-治疗方式
    ContraindicationForTreatmentDrugForTreatment | 治疗禁忌症-治疗药物
    ContraindicationForTreatmentDrugBeforeTreatment | 治疗禁忌症-治疗前药物
    ContraindicationForTreatmentMeasureBeforeTreatment | 治疗禁忌症-治疗前处置
    ContraindicationForTreatmentDrugAfterTreatment | 治疗禁忌症-治疗后药物
    ContraindicationForTreatmentMeasureAfterTreatment | 治疗禁忌症-治疗后处置
    ContraindicationForTreatmentOperationName | 治疗禁忌症-手术名称
    ThemeDiseaseICD | 临床路径适用疾病-ICD编码
    ThemeOperationICD | 临床路径适用手术或操作-ICD编码
    
    
    ### Role types
    
    Agent-Arg | Agent
    Artifact-Arg | Artifact
    Beneficiary-Arg | Beneficiary
    Buyer-Arg | Buyer
    Event-Arg | Event
    Giver-Arg | Giver
    Money-Arg | Money
    Org-Arg | Org
    Person-Arg | Person
    Place-Arg | Place
    Recipient-Arg | Recipient
    Reporter-Arg | Reporter
    Seller-Arg | Seller
    
    [drawing]
    
    # Other aspects of visual presentation. The format is label (form used
    # in other configurations, first of the labels) of the annotation
    # separated by tab from comma-separated key:value pairs. The recognized
    # keys, their values and purpose are:
    # - fgColor     : any HTML color specification (e.g. "black"), sets 
    #                 the color of a span text in the visualization.
    # - bgColor     : any HTML color specification (e.g. "white"), sets 
    #                 the color of a span "box" background in the visualization.
    # - borderColor : any HTML color specification (e.g. "black"), sets 
    #                 the color of a span "box" border in the visualization.
    #                 Also supports special value "darken", which specifies to
    #                 use a darker shade of bgColor for the border.
    # - color       : any HTML color specification (e.g. "black"), sets 
    #                 the color of an arc in the visualization.
    # - dashArray   : any valid SVG stroke-dasharray specification using
    #                 dashes (instead of commas or space) as separators
    #                 (e.g. "3-3"), sets the dash/dot pattern for lines
    #                 in the span/arc visualization ("-" works for solid 
    #                 line)
    # The special labels "SPAN_DEFAULT" and "ARC_DEFAULT" are recognized
    # as setting defaults that will be used for types without specific
    # settings. It is not necessary to define all aspects of the
    # visualization (e.g. just Color can be given): defaults will be
    # used for unspecified cases.
    
    
    SPAN_DEFAULT    fgColor:black, bgColor:lightgreen, borderColor:darken
    ARC_DEFAULT     color:black, dashArray:-, arrowHead:triangle-5, labelArrow:none
    
    # color scheme from
    # http://www.colourlovers.com/palette/314275/marmalade_skies
    # 20663F 259959 ABD406 FFD412 FF821C
    
    Person  bgColor:#FF821C
    Organization    bgColor:#a7c2ff
    GPE     bgColor:#FFD412
    Money   bgColor:#007000, fgColor:white
    
    Alias   dashArray:3-3, arrowHead:none
    
    Individual      glyph:(I)
    Mention         glyph:(N)|(n)|(o), position:left
    
    Negation        box:crossed, glyph:<NONE>, dashArray:<NONE>
    Confidence      glyph:↑|↔|↓
  • 相关阅读:
    vscode中使用less写css样式出现红色波浪线
    vue报错error Trailing spaces not allowed no-trailing-spaces
    visual code 报错error Expected space or tab after '//' in comment spaced-comment
    笔记本电脑已经启动却黑屏
    连接MySQL报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.
    IDEA搭建基于maven的springboot工程
    eclipse 下修改Dynamic Web Modulle 的问题
    firefox(火狐)下 js中设置checkbox属性checked="checked"已有,但复选框却不显示勾选的原因
    unbtun python tab补全
    python之路:进阶篇 内置函数
  • 原文地址:https://www.cnblogs.com/kwzblog/p/13985326.html
Copyright © 2011-2022 走看看