@Thesis와 같은 biblatex 항목이 포함된 .bib 파일에서 필드를 자동으로 제거합니다.

@Thesis와 같은 biblatex 항목이 포함된 .bib 파일에서 필드를 자동으로 제거합니다.

abstractbibtex 항목 뿐만 review아니라 .​ 질문하고 답변한 내용이랑 똑같네요groupfile@Thesis이 질문에, 그러나 biblatex 항목을 포함하는 파일의 경우.

@Thesis.bib 파일의 a에 대한 예제 항목은 다음과 같습니다 .

 @Thesis{Author_18_TheThesis,
  author      = {Mr Author},
  title       = {The Thesis},
  type        = {Doctoral Dissertation},
  institution = {Department of Documents, University of Stackexchange},
  year        = {2018},
  abstract    = {This is the abstract.},
  file        = {:author/Author_18_TheThesis.pdf:PDF},
  review      = {This is the review.},
  groups      = {publications},
}

턱받이 도구, 허용되는 답변은 참조 질문이지만 아직 해당 항목을 지원하지 않는 것 같으며 경고와 함께 건너뜁니다.

@Thesis{Author_18_TheThesis,
_^
*** BibTool ERROR:  (line 123 in ./yourbibliography.bib): Unknown entry type

*** BibTool WARNING: Skipping to next '@'

biblatex 항목이 포함된 .bib 파일에서 이러한 필드를 어떻게 자동으로 제거합니까? (저는 Linux 시스템에서 실행되는 솔루션을 선호합니다).

답변1

앤드류 스완의 답변원래 OP에 링크된 bibtool을 사용하면 리소스가 제공되면 작동합니다 biblatex(ht to moewe).

따라서 파일의 경우 remove-fields.rsc:

preserve.keys = On
preserve.key.case = On
resource{biblatex}
delete.field = { abstract }
delete.field = { review }
delete.field = { groups }
delete.field = { file }

명령:

bibtool -r remove-fields ./references.bib -o new.bib

결과는 다음과 같습니다.

@Thesis{      Author_18_TheThesis,
  Author    = {Mr Author},
  Title     = {The Thesis},
  Type      = {Doctoral Dissertation},
  Institution   = {Department of Documents, University of Stackexchange},
  Year      = {2018},
  ispreprintpublic={test}
}

답변2

알아채다: 기본적으로 biber데이터 모델에 알려지지 않은 필드를 자동으로 삭제합니다. 따라서 비표준 필드를 사용하는 경우 아래 업데이트를 참조하세요.

biber적절한 소스맵과 함께 의 도구 모드를 사용할 수 있습니다 .

biber의 도구 모드에서는 데이터 소스에서 작동하므로 명령줄에서 다음과 같이 실행해야 합니다.

biber --tool --configfile=biber-tool.conf <mybibfile>.bib

(물론 <>적절한 파일 이름으로 대체할 수 있는 경우도 있습니다.)

biber-tool.confBiber가 파일로 수행할 작업을 지정합니다. 귀하의 경우 항목에서 특정 필드를 삭제하려고 하므로 소스맵이 이에 적합한 도구입니다. 의 내용은 biber-tool.conf다음과 같습니다(출력 모양 제어와 관련된 다른 옵션 포함).

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <output_fieldcase>lower</output_fieldcase>
  <output_indent>2</output_indent>
  <output_align>true</output_align>
  <sourcemap>
    <maps datatype="bibtex" map_overwrite="1">
      <map map_overwrite="1">
        <map_step map_field_set="abstract" map_null="1"/>
        <map_step map_field_set="review" map_null="1"/>
        <map_step map_field_set="groups" map_null="1"/>
        <map_step map_field_set="file" map_null="1"/>
      </map>
    </maps>
  </sourcemap>
</config>

이 설정을 사용하면 biber 위의 명령은 <mybibfile>_bibertool.bib지정된 필드를 제거한 새 파일을 출력합니다.

귀하의 입력 결과는 다음과 같습니다:

@thesis{Author_18_TheThesis,
  author      = {Author, Mr},
  institution = {Department of Documents, University of Stackexchange},
  date        = {2018},
  title       = {The Thesis},
  type        = {Doctoral Dissertation},
}

업데이트: 기본적으로 biber데이터 모델에 알려지지 않은 필드를 자동으로 삭제합니다. 따라서 데이터 소스에 이러한 항목이 있거나 확실하지 않고 무시된 필드에 대해 경고를 받으려면 다음 옵션을 사용하십시오 --validate-datamodel.

biber --tool --validate-datamodel <mybibfile>.bib

항목에 대해 다음과 같은 경고가 표시됩니다.

WARN - Datamodel: Entry 'Author_18_TheThesis' (references.bib): Field 'groups' invalid in data model - ignoring
WARN - Datamodel: Entry 'Author_18_TheThesis' (references.bib): Field 'ispreprintpublic' invalid in data model - ignoring

biber이제 이러한 필드를 삭제하는 것을 원하지 않고 유지해야 하는 경우 해당 필드를 포함하도록 의 데이터 모델을 확장해야 합니다. 이는 사용자 정의 biber-tool.conf에서 비표준 필드를 추가하여 수행할 수 있습니다. <fields>...</fields>그룹. 귀하의 경우(여기서는 "리터럴" 유형 필드라고 가정):

<field fieldtype="field" datatype="literal">ispreprintpublic</field>
<field fieldtype="field" datatype="literal">groups</field>

그리고 그룹 내에 다음을 <entryfields><entrytype>thesis</entrytype>...<\entryfields>추가합니다.

<field>ispreprintpublic</field>
<field>groups</field>

결과 사용자 정의는 biber-tool.conf다음과 같습니다.

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <output_fieldcase>lower</output_fieldcase>
  <output_indent>2</output_indent>
  <output_align>true</output_align>
  <sourcemap>
    <maps datatype="bibtex" map_overwrite="1">
      <map map_overwrite="1">
        <map_step map_field_set="abstract" map_null="1"/>
        <map_step map_field_set="review" map_null="1"/>
        <map_step map_field_set="groups" map_null="1"/>
        <map_step map_field_set="file" map_null="1"/>
      </map>
    </maps>
  </sourcemap>
  <datamodel>
    <fields>
      <field fieldtype="field" datatype="literal">ispreprintpublic</field>
      <field fieldtype="field" datatype="literal">groups</field>
    </fields>
    <entryfields>
      <entrytype>thesis</entrytype>
      <field>ispreprintpublic</field>
      <field>groups</field>
    </entryfields>
  </datamodel>
</config>

이를 통해 이 입력에 대해 다음을 수행합니다.

@Thesis{Author_18_TheThesis,
  author      = {Mr Author},
  title       = {The Thesis},
  type        = {Doctoral Dissertation},
  institution = {Department of Documents, University of Stackexchange},
  year        = {2018},
  abstract    = {This is the abstract.},
  file        = {:author/Author_18_TheThesis.pdf:PDF},
  review      = {This is the review.},
  groups      = {publications},
  ispreprintpublic = {test},
}

출력은 다음과 같습니다

@thesis{Author_18_TheThesis,
  author           = {Author, Mr},
  institution      = {Department of Documents, University of Stackexchange},
  date             = {2018},
  ispreprintpublic = {test},
  title            = {The Thesis},
  type             = {Doctoral Dissertation},
}

이것은 특별히 간단하지 않습니다. 그러나 한 말을 인용하자면논평PLK에서 이 문제에 대해 다음과 같이 말했습니다. "도구 모드에서 데이터 모델을 사용하면 이러한 종류의 문제보다 더 큰 이점이 있습니다."

답변3

또 다른 옵션은 bib2bibbibtex 항목을 필터링/추출/확장하는 매우 유연하고 안정적인 방법을 제공하는 도구입니다. 이 (거의 알려지지 않은) 유틸리티는 다음의 일부입니다.bibtex2html도구 제품군. (참고: 검색해야 합니다.PDF문서, HTML 문서에서는 이에 대해 논의하지 않습니다 bib2bib.)

예를 들어, biblatex.bib파일에서 특정 필드를 제거하고 출력을 다음 위치에 저장하려면 bibtex.bib:

bib2bib --remove abstract --remove file --remove review -ob bibtex.bib biblatex.bib   

--rename <old> <new>필터 및 정렬 옵션을 지정하고 필드 이름을 바꾸는 등의 작업도 가능합니다 .

답변4

Sublime과 같은 텍스트 편집기를 사용하여 수동으로 수행할 수 있습니다. Regex 기능(Mac에서는 option+command+R)을 활성화하고 다음을 찾습니다.

abstract = {.*},

그리고 그것을 아무것도 아닌 것으로 대체하십시오.

이렇게 하면 abstract = {과 사이의 모든 항목이 제거됩니다.},

이를 다른 분야에 적용할 수 있습니다.

관련 정보