Code Monkey home page Code Monkey logo

bibtex-parser's People

Contributors

andrechalom avatar arandilopez avatar eknoes avatar extracts avatar icanhazstring avatar lejeanbono avatar marionleherisson avatar raphael-st avatar renanbr avatar saschaszott avatar tspencer244 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bibtex-parser's Issues

add case tag name option to the listener

One other suggestion I might make it so lowercase the key names. Some of my entries were Year, and others were year, so I had to write some code to lowercase all the key names across the board. Relatively minor but I did read that key names are supposed to be case insensitive anyway.
from ubergeek42@3b4b07d

Possible solution: $listener->changeTagNameCase(\CASE_LOWER)

citation key is ignored

The following bibtex isn't well parsed, citation key isn't detected.

@article{imhere}

The expected result is:

Array
(
    [0] => Array
        (
            [type] => article
            [citation-key] => imhere
        )

)

Version 1

$parser = new RenanBr\BibTexParser\Parser();
$listener = new RenanBr\BibTexParser\Listener();
$parser->addListener($listener);
$parser->parseString('@article{imhere}');
$entries = $listener->export();
print_r($entries);
Array
(
    [0] => Array
        (
            [type] => article
        )

)

Version 2 (dev)

$parser = new RenanBr\BibTexParser\Parser();
$listener = new RenanBr\BibTexParser\Listener();
$listener->addProcessor(new RenanBr\BibTexParser\Processor\CitationKeyProcessor());
$parser->addListener($listener);
$parser->parseString('@article{imhere}');
$entries = $listener->export();
print_r($entries);
Array
(
    [0] => Array
        (
            [type] => article
            [citation-key] => 
        )

)

Collision between key `type` (php array) and field `type` (bibtex/biblatex)

Consider the next test.php

use RenanBr\BibTexParser\Listener;
use RenanBr\BibTexParser\Parser;

require 'vendor/autoload.php';

$bibtex = <<<BIBTEX
@TechReport{Plotkin_1995,
    author = {Serge Plotkin},
    title = {Research in Graph Algorithms and Combinatorial Optimization},
    year = 1995,
    month = mar,
    type = {resreport},
    doi = {10.21236/ada292630},
    url = {https://doi.org/10.21236%2Fada292630},
    publisher = {Defense Technical Information Center}
}
BIBTEX;

$parser = new Parser();          // Create a Parser
$listener = new Listener();      // Create and configure a Listener
$parser->addListener($listener); // Attach the Listener to the Parser
$parser->parseString($bibtex);   // or parseFile('/path/to/file.bib')
$entries = $listener->export();  // Get processed data from the Listener

print_r($entries);

Output from > php test.php | nl

     1  Array
     2  (
     3      [0] => Array
     4          (
     5              [type] => resreport
     6              [citation-key] => Plotkin_1995
     7              [author] => Serge Plotkin
     8              [title] => Research in Graph Algorithms and Combinatorial Optimization
     9              [year] => 1995
    10              [month] => mar
    11              [doi] => 10.21236/ada292630
    12              [url] => https://doi.org/10.21236%2Fada292630
    13              [publisher] => Defense Technical Information Center
    14              [_original] => @techreport{Plotkin_1995,
    15          author    = {Serge Plotkin},
    16          title     = {Research in Graph Algorithms and Combinatorial Optimization},
    17          year      = 1995,
    18      month     = mar,
    19      type      = {resreport},
    20      doi       = {10.21236/ada292630},
    21          url       = {https://doi.org/10.21236%2Fada292630},
    22          publisher = {Defense Technical Information Center}
    23  }
    24          )
       
    25  )

But line 5 in the output should be

     5              [type] => TechReport

or better

     5              [_type] => TechReport
...
     11             [type] => resreport

Clearly, this is because of the collision between key type (php array) and bib-field type, a legal field in bibtex § 2.2 and biblatex § 4.9.2.13.

Maybe the patches...

# Parser.php
    19    const TYPE = '_type';

and

# Listener.php
    66                $this->entries[] = [Parser::TYPE => $text];
...
    84                    if ('string' === $entry[Parser::TYPE] && array_key_exists($text, $entry)) {

...work, but I'm not sure if this is enough.

support for PHP 5

There is nothing in the API that justifies do not support this PHP version.

Provide shortcut functions

This library could provide these shortcuts:

function parse_bibtex_file(string $filename, array $processors = []): array;
function parse_bibtex_string(string $bibtex, array $processors = []): array;

Usage:

use function RenanBr\BibTexParser\parse_bibtex_file;

$entries = parse_bibtex_file('/path/to/file.bib');

Feature request: multiple processors?

I would like to use more than one Processor for setTagValueProcessor(). Should I

(1) write a wrapper function that calls all of the Processors? (easiest to do, but I think this generates less clear code)
(2) rewrite setTagValueProcessor() to accept an array of callables?
(3) rewrite setTagValueProcessor() to accept a callable, but allow it to "stack" these callables so I can write

$listener->setTagValueProcessor(new AuthorProcessor());
$listener->setTagValueProcessor(new HTMLEntitiesProcessor());

Unexpected character '\0' at line 19 column 2

I'm trying to parse a bibtex using your library, but I'm getting the following error :

Unexpected character '\0' at line 19 column 2

Any way to support the null character ?
Thanks 😄

ParserException: Unexpected character

Consider the next example:

<?php

use RenanBr\BibTexParser\Listener;
use RenanBr\BibTexParser\Parser;

require 'vendor/autoload.php';

$bibtex = <<<BIBTEX
@String{Andrasfai            = {Andr{\'{a}}sfai, B{\'{e}}la}}
@String{Bollobas             = {Bollob{\'{a}}s, B{\'{e}}la}}
@String{Chvatal              = {Chv{\'{a}}tal, Va{\v{s}}ek}}
@String{Erdos                = {Erd{\H{o}}s, Paul}}
@String{Gyarfas              = {Gy{\'{a}}rf{\'{a}}s, Andr{\'{a}}s}}
@String{Lovasz               = {Lov{\'{a}}sz, L{\'{a}}szl{\'{o}}}}
@String{Balbuena             = {Balbuena, Camino}}
@String{Cera                 = {Cera, Mart{\'{\i}}n}}
@String{Dianez               = {Di{\'{a}}nez, Ana}}
@String{Garcia-Vazquez       = {Garc{\'{\i}}a-V{\'{a}}zquez, Pedro}}

@Article{BCDGV07TopologicalFree,
  author    = Balbuena #{ and } # Cera #{ and } # Dianez #{ and } # Garcia-Vazquez,
  title     = {New exact values of the maximum size of graphs free of topological complete subgraphs},
  journal   = {Discrete Mathematics},
  year      = {2007},
  volume    = {307},
  number    = {9-10},
  pages     = {1038--1046},
  issn      = {0012-365X},
  doi       = {10.1016/j.disc.2006.07.031},
  keywords  = {Extremal graphs},
  publisher = {Elsevier {BV}},
  }
BIBTEX;
$parser = new Parser();          // Create a Parser
$listener = new Listener();      // Create and configure a Listener
$parser->addListener($listener); // Attach the Listener to the Parser
$parser->parseString($bibtex);   // or parseFile('/path/to/file.bib')
$entries = $listener->export();  // Get processed data from the Listener

print_r($entries);
?>

Which gives the following:

PHP Fatal error:  Uncaught RenanBr\BibTexParser\Exception\ParserException: Unexpected character '-' at line 13 column 75 in ~/PHP/vendor/renanbr/bibtex-parser/src/Exception/ParserException.php:28
Stack trace:
#0 ~/PHP/vendor/renanbr/bibtex-parser/src/Parser.php(349): RenanBr\BibTexParser\Exception\ParserException::unexpectedCharacter(''-'', 13, 75)
#1 ~/PHP/vendor/renanbr/bibtex-parser/src/Parser.php(368): RenanBr\BibTexParser\Parser->readPreTagContent('-')
#2 ~/PHP/vendor/renanbr/bibtex-parser/src/Parser.php(185): RenanBr\BibTexParser\Parser->readRawTagContent('-')
#3 ~/PHP/vendor/renanbr/bibtex-parser/src/Parser.php(124): RenanBr\BibTexParser\Parser->read('-')
#4 ~/PHP/vendor/renanbr/bibtex-parser/src/Parser.php(112): RenanBr\BibTexParser\Parser->parse('@String{Andrasf...')
#5 ~/PHP/parserbib.php(37): RenanBr\BibTexParser\Parser->parseString('@String{Andrasf...')
#6 {main}
  thrown in ~/PHP/vendor/renanbr/bibtex-parser/src/Exception/ParserException.php on line 28

This seems to be caused by the character - in the string constant Garcia-Vazquez, created at line 10 of the bib-file:

@String{Garcia-Vazquez       = {Garc{\'{\i}}a-V{\'{a}}zquez, Pedro}}

...and subsequently used in the author field at line 13.

According to this answer, only the characters " # ' ( ) , = { } % should be banned in bib-keys, if possible.

According this bibtex-summary the placeholder (variable/string name) must start with a letter and can contain any character in [A-Z,a-z,_,0-9]. In any case, the character _ gives the same issue.

ParserException Unexpected character 'c' at line 13 column 200

https://www.sciencedirect.com/science/article/pii/S1877050917317398

@Article{XU20171077,
title = "Cost Extension Control Model in Digital Context: From Continuous Cost Reduction to Value Co-creation",
journal = "Procedia Computer Science",
volume = "122",
pages = "1077 - 1083",
year = "2017",
note = "5th International Conference on Information Technology and Quantitative Management, ITQM 2017",
issn = "1877-0509",
doi = "https://doi.org/10.1016/j.procs.2017.11.476",
url = "http://www.sciencedirect.com/science/article/pii/S187705091732731X",
author = "Ling Xu and Chengxiao Zhang and Jing Guo and Xingsen Li",
keywords = "Digital, Cost control, Extension method, Big data, Value co-creation",
abstract = "Digital technology has brought about great changes in organizational structure, the way of value creation and profit-making methods, which brings new challenges to cost control based on "chain". In this paper, cost control in digital context is promoted to the pattern design level, combining the cost control process and the value creation process into one. with the new characteristics of cost control, this paper puts forward that extension method can be the method and tool of cost control, and provides the optimization of strategic choice and model innovation following. Finally, the prospect of intelligent cost control based on Extenics is prospected."
}

Is it possible to ignore the " within the text?

allow processors to delete an entry

An possible solution is to delete an entry if processor returns null

Example of use case:

$listener->addProcessor(function (array $entry) {
    if (!myFuncToCheckIfDoiIsValid($entry['doi'])) {
        return null;
    }

    return $entry;
});

[maintenance] reorganize tests

Main changes:

  • Split test methods, because ParserTest and ListenerTest classes are too long
  • Move all valid bib files to tests/resources/valid/

phpmd violations

$ phpmd src/ text cleancode
src/Parser.php:109	The method parse uses an else expression. Else is never necessary and you can simplify the code to work without else.
src/Parser.php:198	The method readType uses an else expression. Else is never necessary and you can simplify the code to work without else.
src/Parser.php:226	The method readKey uses an else expression. Else is never necessary and you can simplify the code to work without else.
src/Parser.php:293	The method readRawValue uses an else expression. Else is never necessary and you can simplify the code to work without else.
src/Parser.php:321	The method readDelimitedValue uses an else expression. Else is never necessary and you can simplify the code to work without else.
src/Parser.php:327	The method readDelimitedValue uses an else expression. Else is never necessary and you can simplify the code to work without else.
$ phpmd src/ text codesize
src/Parser.php:14	The class Parser has an overall complexity of 87 which is very high. The configured complexity threshold is 50.
src/Parser.php:140	The method read() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
src/Parser.php:250	The method readValue() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
src/Parser.php:305	The method readDelimitedValue() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
$ phpmd src/ text controversial,design,naming,unusedcode; echo $?
0

implement FillMissingProcessor

@article{
  title = {foo},
  description = {lorem ipsum dolor}
}
@article{
  title = {bar}
}
use RenanBr\BibTexParser\Processor\FillMissingProcessor;
$listener->addProcessor(new FillMissingProcessor([
    'description' => 'this entry has no description',
]));

Expected result:

Array
(
    [0] => Array
        (
            [title] => foo
            [description] => lorem ipsum dolor
        )
    [1] => Array
        (
            [title] => bar
            [description] => this entry has no description
        )
)

How I can implement Multi-QuoteProcessor?

Hi renabr!
I am using your bibtex-parser. I've got bibtex file through sciencedirect, but it was invalid bib.
so I've reviewed the bibtex file. That file contains multi-quote. I guess it is the issue.
therefore, I am trying to implement quoteProcessor, so I need your help.

Dealing with double braces

Some research units export files with double braces in it. It looks like this is an acceptable format, however unfortunate it might be. Here is an example:

@article{ ISI:000440287200008,
Author = {Dubos, Nicolas and Le Viol, Isabelle and Robert, Alexandre and
   Teplitsky, Celine and Ghislain, Manon and Dehorter, Olivier and
   Julliard, Romain and Henry, Pierre Yves},
Title = {{Disentangling the effects of spring anomalies in climate and net primary
   production on body size of temperate songbirds}},
Journal = {{ECOGRAPHY}},
Year = {{2018}},
Volume = {{41}},
Number = {{8}},
Pages = {{1319-1330}},
Month = {{AUG}},
Abstract = {{Body size is implicated in individual fitness and population dynamics.
   Mounting interest is being given to the effects of environmental change [...]
   growth than food assimilation.}},
DOI = {{10.1111/ecog.03413}},
ISSN = {{0906-7590}},
EISSN = {{1600-0587}},
Keywords = {{body size; climate; birds}},
Keywords-Plus = {{TIT PARUS-MAJOR; ENVIRONMENTAL-CHANGE; GREAT TIT; NESTLING GROWTH;
   PASSERINE BIRD; BERGMANNS RULE; SURVIVAL; MODEL; MASS; ECOSYSTEMS}},
Research-Areas = {{Biodiversity \& Conservation; Environmental Sciences \& Ecology}},
Times-Cited = {{0}},
Unique-ID = {{ISI:000440287200008}},
}

As a result, title, year and other affected fields will contain (single) braces after parsing. Is there a way bibtex-parser can deal with this, or is this syntax simply not accepted?

(BTW we are still on version 0.5, please let me know if this has since been solved in later versions.)

Feature request: parse author names

BibTex recognizes four parts of an author's name: First Von Last Jr.

For instance, the entry "Ludwig von Beethoven" has First: "Ludwig", von-part: "von" and Last: "Beethoven" and no Junior-part. The entry "Ford, Jr., Henry" has First: "Henry", no von-part, Last: "Ford" and Junior-part: "Jr.".

Is it possible to implement this parsing of names on bibtex-parser? The only PHP library I found that implements this is a very old and unmantained one, called Structures_BibTex.

References:
https://nwalsh.com/tex/texhelp/bibtx-23.html
https://github.com/pear/Structures_BibTex/blob/master/Structures/BibTex.php

Listener isn't reusable

Once export() is called, future found entries are not processed.

$parser = new \RenanBr\BibTexParser\Parser();
$listener = new \RenanBr\BibTexParser\Listener();
$listener->addProcessor(function (array $entry) {
    $entry['title'] .= ' processed';
    return $entry;
});
$parser->addListener($listener);

$parser->parseString('@misc{title="A"}');
$listener->export(); // <--- first call

$parser->parseString('@misc{title="B"}');
$entries = $listener->export(); // <--- second call

var_dump(array_column($entries, 'title'));

Expected result:

array(2) {
  [0] =>
  string(11) "A processed"
  [1] =>
  string(1) "B processed"
}

Actual result:

array(2) {
  [0] =>
  string(11) "A processed"
  [1] =>
  string(1) "B"
}

implement DateProcessor

It could be interesting to have a standardized way to read entries' date.

We could read month and year tags for providing DateTime object within _date key of processed entries.

implement UrlFromDoiProcessor

@article{
  doi = {xyz}
}
use RenanBr\BibTexParser\Processor\UrlFromDoiProcessor;
$listener->addProcessor(new UrlFromDoiProcessor());

Expected result:

Array
(
    [0] => Array
        (
            [doi] => xyz
            [url] => https://doi.org/xyz
        )
)

release 1.0.0

  • PHP 7.2 support
  • Drop deprecated (and move their tests)

@Comment cause ParserException::unexpectedCharacter

Hi,

I'm working on a .bib file that contain some "@comment{}" and when the parser arrive to one of them, it cause an error, because they don't have to be valid entry and some aren't...

Actually, the rule is that everything from the @comment and to the end of line is ignored. The remainder lines of the commented entry is ignored by the first comment mechanism we described; in particular a @comment does not need to be a valid entry, i.e. it can for example skip comas between two fields
http://maverick.inria.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html#comment

In my case "@comment" are always on one line and no line is very long.
So I just fixed it with a "fgets" instead of "fread" and a small exeption in the parseFile function :

public function parseFile($file)
{
    $handle = fopen($file, 'r');
    try {
        $this->reset();
        while (!feof($handle)) {
            $buffer = fgets($handle);//fread($handle, 128);
            if (strpos($buffer, '@Comment{') === false) {
                $this->parse($buffer);
            }
        }
        $this->throwExceptionIfReadingEntry("\0");
    } finally {
        fclose($handle);
    }
}

"@comment" in my .bib file :

@Comment{jabref-meta: databaseType:bibtex;}
@Comment{jabref-entrytype: Poster: req[author;title;year;organization] opt[abstract]}

I found that they are automaticaly added by JabRef (http://www.jabref.org/) at the end of the .bib file.
JabRef/jabref#2944

Have a nice day!

concatenation of braced string is an extra feature

When quotation-marks are used, string concatenation using # is possible, but not when braces are used.

From: http://www.bibtex.org/Format/

Currently, concatenation works even when braces are used.

Users should be informed about that in the docs ... or maybe this library could work strictly, it means to throw a ParseException in the Parser (or in the Listener).

Parser::ENTRY isn't triggered

Parser doesn't trigger listener with the original entry value when the input ends with }

$parser = new Parser();
$listener = new Listener();
$parser->addListener($listener);
$parser->parseString('@misc{title="findme"}');
$entries = $listener->export();
print_r($entries);

Expected result:

Array
(
    [0] => Array
        (
            [type] => misc
            [title] => findme
            [_original] => @misc{title="findme"}
        )

)

Actual output:

Array
(
    [0] => Array
        (
            [type] => misc
            [title] => findme
        )

)

Note: It works fine when adding a space at the end of the input.

$parser->parseString('@misc{title="findme"} ');

Test in PHP 7.4

Currently nightly PHP version in the CI targets to v8, in addition v7.4 is knocking the door.

Parse special characters in reference properly

Hi,

I have lots of german bibtexs which contain special characters in their reference, for example:

@article{schünemann2013evaluation,
    title={Evaluation and control of the orientation of small molecules for strongly absorbing organic thin films},
    author={Schünemann, Christoph and Wynands, David and Eichhorn, Klaus-Jochen and Stamm, Manfred and Leo, Karl and Riede, Moritz},
    journal={The Journal of Physical Chemistry C},
    volume={117},
    number={22},
    pages={11600--11609},
    year={2013},
    publisher={ACS Publications},
    doi={10.1021/jp400604j}
    }

I am working on a PR to fix it, if you don't mind.

implement TrimProcessor

@article{
  title = " trimmed     ",
}
use RenanBr\BibTexParser\Processor\TrimProcessor;
$listener->addProcessor(new TrimProcessor());

Expected result var_dump() result for $entries[0]['title']:

string(7) "trimmed"

change how to deal with comments

Revisiting the bibtex documentation due the issue #6 I've found these statements regarding comments in files:

§4, item 7, p. 13

For Scribe compatibility, the database files allow an @comment command; it's not really needed because BibTEX allows in the database files any comment that's not within an entry. If you want to comment out an entry, simply remove the '@' character preceding the entry type.

§4, item 14, p. 14

LATEX's comment character '%' is not a comment character in the database files.

Note: This may introduce BC breaks, some tests should not fail because some examples of invalid files will not be invalid anymore. The possible breaks are in a good direction, once files already valid should be interpreted as always.

BibTex Parser 3 Roadmap

Goals

  • make the code source more modern
  • improve code source readability
  • improve documentation

Topics

  • entries as object Entry instead of array
    • an immutable object
    • do not mix up tags with non-tag stuff, it means provide these methods in Entry class:
      • getCitationKey(): string
      • getType(): string
      • getOriginal(): string
      • getTag(string $name): Stringable (PHP 8.0)
        • processors may return a "stringable" ArrayIterator for lists (e.g. keywords, author)
  • create a ProcessorInterface
    • type-hint processor's argument and return as Entry (PHP 7.0)
  • instantiate a default Listener in Parser
    • provide a way to clear listeners in Parser
  • don't leak abbreviation among files (bug in v2?)
    • trigger Listeners when Parser reaches the end of a file (or string input)
  • place interfaces under an unified namespace
  • stricter static analysis check
  • more examples in documentation
    • how to integrate this library with the most popular frameworks

ParserException Unexpected character '’' at line 169 column 10

@Article{O’Connor2017653
title = "Privacy by Design: Informed Consent and Internet of Things for Smart Health ",
journal = "Procedia Computer Science ",
volume = "113",
number = "",
pages = "653 - 658",
year = "2017",
note = "The 8th International Conference on Emerging Ubiquitous Systems and Pervasive Networks (EUSPN 2017) / The 7th International Conference on Current and Future Trends of Information and Communication Technologies in Healthcare (ICTH-2017) / Affiliated Workshops ",
issn = "1877-0509",
doi = "https://doi.org/10.1016/j.procs.2017.08.329",
url = "https://www.sciencedirect.com/science/article/pii/S1877050917317398",
author = "Yvonne O’Connor and Wendy Rowan and Laura Lynch and Ciara Heavin",
keywords = "Informed Consent",
keywords = "IOT",
keywords = "Smart Health",
keywords = "Privacy by Design ",
abstract = "Abstract Check: I accept the terms and conditions and privacy policy statements associated with this technological artefact! The informed consent process is becoming more of a challenge with the emergence of Internet of Things (IoT) as data may be collected without the digital health citizen being aware. It is argued in this paper that the first phase for universal usability of IoT within the smart health domain is to ensure that digital health citizens (i.e. user of technology) are fully aware of what they are consenting to when they register an account with such technological artefacts. This point is further reinforced by the proposed ‘Privacy by Design’ requirements associated with the forthcoming General Data Protection Regulation (GDPR). This paper proposes some practical approaches which should be considered when designing and developing IoT for data collection and data sharing within the health domain. "
}

v2 roadmap

General:

  • Require PHP ^7.1 (2b69a51, 0bc19cf, f95f7e6) moved to #41
  • Exceptions refactoring Replace ParseException with Exception (48c7048, facdf1f)
    • To be used for general purpose, not only for "parser" stuff
    • Create a namespace Exception, and put all needed exceptions inside it
    • Make exceptions implement a base ExceptionInterface
  • Make Listener able to manage "entry processors" instead of "tag processors" (aed4c2e)
    • It'll make possible to inject tags, or to process multiple at the same time
  • No longer use variable reference in processors (aed4c2e)
    • Processor must return the modified entry
    • The code will be more readable
    • There is no real need to use references in this case
  • Translate v1 tag processors into entry processors (5f3efda, 22e8f1c)
    • To keep current features working as well
  • Move "citation key" and "tag name case" processing from Listener to specialized entry processors (e05182d, 40a9709)
    • Listener becomes simpler
    • Listener becomes more extensible

Coming entry processors:

  • DateProcessor #28
    • Appends _date tag with a DateTime instance
  • DoiToUrlProcessor #37
    • Fills url tag if this one is missing using DOI
  • TrimProcessor #36
    • Strips whitespace from the beginning and end of all tags' values

Internals:

Thoughts:

  • Handle entries as objects instead of arrays

Exception:exception 'RenanBr\BibTexParser\Exception\ParserException' with message 'Unexpected character 'q' at line 11 column 1476'

https://www.sciencedirect.com/science/article/pii/S0022460X15007506
The following is Bibtex file content.
@Article{ABBOUD2016305,
title = "Deterministic-random separation in nonstationary regime",
journal = "Journal of Sound and Vibration",
volume = "362",
pages = "305 - 326",
year = "2016",
issn = "0022-460X",
doi = "https://doi.org/10.1016/j.jsv.2015.09.029",
url = "http://www.sciencedirect.com/science/article/pii/S0022460X15007506",
author = "D. Abboud and J. Antoni and S. Sieg-Zieba and M. Eltabach",
abstract = "In rotating machinery vibration analysis, the synchronous average is perhaps the most widely used technique for extracting periodic components. Periodic components are typically related to gear vibrations, misalignments, unbalances, blade rotations, reciprocating forces, etc. Their separation from other random components is essential in vibration-based diagnosis in order to discriminate useful information from masking noise. However, synchronous averaging theoretically requires the machine to operate under stationary regime (i.e. the related vibration signals are cyclostationary) and is otherwise jeopardized by the presence of amplitude and phase modulations. A first object of this paper is to investigate the nature of the nonstationarity induced by the response of a linear time-invariant system subjected to speed varying excitation. For this purpose, the concept of a cyclo-non-stationary signal is introduced, which extends the class of cyclostationary signals to speed-varying regimes. Next, a “generalized synchronous average’’ is designed to extract the deterministic part of a cyclo-non-stationary vibration signal—i.e. the analog of the periodic part of a cyclostationary signal. Two estimators of the GSA have been proposed. The first one returns the synchronous average of the signal at predefined discrete operating speeds. A brief statistical study of it is performed, aiming to provide the user with confidence intervals that reflect the "quality" of the estimator according to the SNR and the estimated speed. The second estimator returns a smoothed version of the former by enforcing continuity over the speed axis. It helps to reconstruct the deterministic component by tracking a specific trajectory dictated by the speed profile (assumed to be known a priori).The proposed method is validated first on synthetic signals and then on actual industrial signals. The usefulness of the approach is demonstrated on envelope-based diagnosis of bearings in variable-speed operation."
}
I am trying to parse this file using your lib, but it don't work.
I've got this error:
Exception:exception 'RenanBr\BibTexParser\Exception\ParserException' with message 'Unexpected character 'q' at line 11 column 1476' in ....
How I can solve this issue?
(I think it is a quote process like "quality".)

invalid char before tag content isn't caught

Parser ignores non-valid characters when reading tag's content.

use RenanBr\BibTexParser\Listener;
use RenanBr\BibTexParser\Parser;

$parser = new Parser();
$listener = new Listener();
$parser->addListener($listener);
$parser->parseString('@misc{foo=)"bar"}');
$entries = $listener->export();
print_r($entries);

Expected result:

An exception saying ) character was not expected

Actual result:

Array
(
    [0] => Array
        (
            [type] => misc
            [foo] => bar
            [_original] => @misc{foo=)"bar"}
        )
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.