Jupyter Example

A minimal example for using text-matcher as a module, in a Jupyter notebook or otherwise.


In [2]:
from text_matcher import matcher

In [10]:
ta = matcher.Text(open('test/adams.txt').read(), 'Adams')
tb = matcher.Text(open('test/middlemarch.txt').read(), 'Middlemarch')

In [11]:
matcher.Matcher(ta, tb).match()


25 total matches found.
Extending match forwards with words: pray pray
Extending match forwards with words: marry marry
Extending match forwards with words: fervid fervid
Extending match forwards with words: stay stay
Extending match forwards with words: us us
Extending match forwards with words: lik lik
Extending match forwards with words: murd murd
Extending match forwards with words: everyth everyth
Extending match forwards with words: els els
Extending match forwards with words: gon gon
Extending match forwards with words: husband husband
Extending match forwards with words: lov lov
Extending match forwards with words: trust trust
Extending match forwards with words: us us
Extending match forwards with words: hav hav
Extending match forwards with words: help help
Extending match forwards with words: mad mad
Extending match forwards with words: curs curs
Extending match forwards with words: lif lif


match 1:
Adams: (12034, 12443) closely, as the first description of Dorothea shows mind was theoretic, and yearned by its nature after some lofty conception of the world which might frankly include the parish of Tipton and her own rule of conduct there; she was enamoured of intensity and greatness, and rash in embracing whatever seemed to her to have those aspects; likely to seek martyrdom, to make retractations, and then to incur martyrdom after all in a quarter where she had not sought central issue of marriage is raised immediately
Middlemarch: (5809, 6218) interest in gimp and artificial protrusions of drapery mind was theoretic, and yearned by its nature after some lofty conception of the world which might frankly include the parish of Tipton and her own rule of conduct there; she was enamoured of intensity and greatness, and rash in embracing whatever seemed to her to have those aspects; likely to seek martyrdom, to make retractations, and then to incur martyrdom after all in a quarter where she had not sought Certainly such elements in the character of a marriageable girl


match 2:
Adams: (12574, 12694) immediately-"And how should Dorothea not marry?" (p. 6)-with its obvious answer young lady of some birth and fortune, who knelt suddenly down on a brick floor by the side of a sick labourer and prayed fervidly 3George Eliot's "Middlemarch" Notebooks
Middlemarch: (8751, 8870) might lead her at last to refuse all young lady of some birth and fortune, who knelt suddenly down on a brick floor by the side of a sick laborer and prayed fervidly as if she thought herself living in the time of the Apostles


match 3:
Adams: (13292, 13447) org/terms 74 NINETEENTH-CENTURY FICTION thought herself living in the time of the Apostles-who had strange whims of fasting like a Papist, and of sitting up at night to read old theological books Although the parallel relaxes, it remains the organizing
Middlemarch: (8890, 9046) side of a sick laborer and prayed fervidly thought herself living in the time of the Apostles--who had strange whims of fasting like a Papist, and of sitting up at night to read old theological books wife might awaken you some fine


match 4:
Adams: (14122, 14210) Dorothea's cottages on his own estate, her enthusiastic reply think we deserve to be beaten out of our beautiful houses with a scourge of small cords earlier, with Casaubon overhearing, she had cried out at dinner
Middlemarch: (57013, 57100) energetically, forgetting her previous small vexations think we deserve to be beaten out of our beautiful houses with a scourge of small cords all of us who let tenants live


match 5:
Adams: (15431, 15562) letter of proposal as what we might term a "call whole soul was possessed by the fact that a fuller life was opening before her: she was a neophyte about to enter on a higher grade This is the Dorothea of "Miss Brooke." Whatever
Middlemarch: (83868, 83999) letter, to look at it critically as a profession of love whole soul was possessed by the fact that a fuller life was opening before her: she was a neophyte about to enter on a higher grade going to have room for the energies which stirred


match 6:
Adams: (32025, 32718) affords a glimpse of the convergent paths of the stories Even with a microscope directed on a water-drop we find ourselves making interpretations which turn out to be rather coarse; for whereas under a weak lens you may seem to see a creature exhibiting an active voracity into which other smaller creatures actively play as if they were so many animated tax-pennies, a stronger lens reveals to you certain tiniest hairlets which make vortices for these victims while the swallower waits passively at his receipt of custom. In this way, metaphorically speaking, a strong lens applied to Mrs. Cadwallader's match-making will show a play of minute causes producing what may be called thought and speech vortices to bring her the sort of food she needed images of the microscope and of microorganisms have their origin
Middlemarch: (116900, 117594) little of women by following them about in their pony-phaetons Even with a microscope directed on a water-drop we find ourselves making interpretations which turn out to be rather coarse; for whereas under a weak lens you may seem to see a creature exhibiting an active voracity into which other smaller creatures actively play as if they were so many animated tax-pennies, a stronger lens reveals to you certain tiniest hairlets which make vortices for these victims while the swallower waits passively at his receipt of custom. In this way, metaphorically speaking, a strong lens applied to Mrs. Cadwallader's match-making will show a play of minute causes producing what may be called thought and speech vortices to bring her the sort of food she needed life was rurally simple, quite free


match 7:
Adams: (37619, 37760) Lydgate's and Chichely's comparison of the two women Lydgate was less ripe, and might possibly have experience before him which would modify his opinion as to the most excellent things in woman motto comparing the two figures of ivory
Middlemarch: (192301, 192441) fine young women to purplefaced bachelors Lydgate was less ripe, and might possibly have experience before him which would modify his opinion as to the most excellent things in woman Miss Brooke, however, was not again seen by either


match 8:
Adams: (38370, 38895) other's lives but on the part they have already Certainly nothing at present could seem much less important to Lydgate than the turn of Miss Brooke's mind, or to Miss Brooke than the qualities of the woman who had attracted this young surgeon. But any one watching keenly the stealthy convergence of human lots, sees a slow preparation of effects from one life on another, which tells like a calculated irony on the indifference or the frozen stare with which we look at our unintroduced neighbour. Destiny stands by sarcastic with our dramatis personae folded in her hand next see Dorothea she is on her wedding trip
Middlemarch: (195148, 195673) laughs for bird-notes, and blue eyes for a heaven Certainly nothing at present could seem much less important to Lydgate than the turn of Miss Brooke's mind, or to Miss Brooke than the qualities of the woman who had attracted this young surgeon. But any one watching keenly the stealthy convergence of human lots, sees a slow preparation of effects from one life on another, which tells like a calculated irony on the indifference or the frozen stare with which we look at our unintroduced neighbor. Destiny stands by sarcastic with our dramatis personae folded in her hand Old provincial society had its share of this


match 9:
Adams: (40743, 40864) religious depth for which her Puritanism does not account Antique form animated by Christian sentiment-a sort of Christian Antigone-sensuous force controlled by spiritual passion None of this serves to advance Middlemarch
Middlemarch: (402604, 402726) would think of Mistress Second-Cousin antique form animated by Christian sentiment--a sort of Christian Antigone--sensuous force controlled by spiritual passion Yes, and that your painting her was the chief outcome


match 10:
Adams: (45360, 45810) cannot suppose we will regard as tragic element of tragedy which lies in the very fact of frequency, has not yet wrought itself into the coarse emotion of mankind; and perhaps our frames could hardly bear much of it. If we had a keen vision and feeling of all ordinary human life, it would be like hearing the grass grow and the squirrel's heart beat, and we should die of that roar which lies on the other side of silence. As it is, the quickest of us walk about well wadded with stupidity end of the next chapter, after her quarrel
Middlemarch: (411725, 412177) expect people to be deeply moved by what is not unusual element of tragedy which lies in the very fact of frequency, has not yet wrought itself into the coarse emotion of mankind; and perhaps our frames could hardly bear much of it. If we had a keen vision and feeling of all ordinary human life, it would be like hearing the grass grow and the squirrel's heart beat, and we should die of that roar which lies on the other side of silence. As it is, the quickest of us walk about well wadded with stupidity However, Dorothea was crying, and if she had been required to state


match 11:
Adams: (45997, 46762) good of the world" is thoroughly laid: To-day begun to see that she had been under a wild illusion in expecting a response to her feeling from Mr. Casaubon, and she had felt the waking of a presentiment that there might be a sad consciousness in his life which made as great a need on his side as on her own. We are all of us born in moral stupidity, taking the world as an udder to feed our supreme selves: Dorothea had early begun to emerge from that stupidity, but yet it had been easier to her to imagine how she would devote herself to Mr. Casaubon, and become wise and strong in his strength and wisdom, than to conceive with that distinctness which is no longer reflection but feeling ... that he had an equivalent centre of self, whence the lights and shadows must always fall with a certain difference pp. 156- 57) Given this major development
Middlemarch: (449403, 450244) some new motive is born. Today begun to see that she had been under a wild illusion in expecting a response to her feeling from Mr. Casaubon, and she had felt the waking of a presentiment that there might be a sad consciousness in his life which made as great a need on his side as on her own. We are all of us born in moral stupidity, taking the world as an udder to feed our supreme selves: Dorothea had early begun to emerge from that stupidity, but yet it had been easier to her to imagine how she would devote herself to Mr. Casaubon, and become wise and strong in his strength and wisdom, than to conceive with that distinctness which is no longer reflection but feeling--an idea wrought back to the directness of sense, like the solidity of objects--that he had an equivalent centre of self, whence the lights and shadows must always fall with a certain difference CHAPTER XXII. "Nous câusames longtemps


match 12:
Adams: (48206, 48423) practical action on behalf of a friend and neighbor Would you not like to be the one person who believed in that man's innocence, if the rest of the world belied him? ... People glorify all sorts of bravery except the bravery they might show on behalf of their nearest neighbours" (p. 538). Her instinctive understanding of what is tragic in Lydgate's
Middlemarch: (1575265, 1576437) cruel!" said Dorothea, clasping her hands would you not like to be the one person who believed in that man's innocence, if the rest of the world belied him? Besides, there is a man's character beforehand to speak for him." "But, my dear Mrs. Casaubon," said Mr. Farebrother, smiling gently at her ardor, "character is not cut in marble--it is not something solid and unalterable. It is something living and changing, and may become diseased as our bodies do." "Then it may be rescued and healed," said Dorothea "I should not be afraid of asking Mr. Lydgate to tell me the truth, that I might help him. Why should I be afraid? Now that I am not to have the land, James, I might do as Mr. Bulstrode proposed, and take his place in providing for the Hospital; and I have to consult Mr. Lydgate, to know thoroughly what are the prospects of doing good by keeping up the present plans. There is the best opportunity in the world for me to ask for his confidence; and he would be able to tell me things which might make all the circumstances clear. Then we would all stand by him and bring him out of his trouble. People glorify all sorts of bravery except the bravery they might show on behalf of their nearest neighbors." Dorothea's eyes had a moist brightness


match 13:
Adams: (49263, 49979) Miss Brooke. As he rides away he thinks This young creature has a heart large enough for the Virgin Mary. She evidently thinks nothing of her own future, and would pledge away half her income at once, as if she wanted nothing for herself but a chair to sit in from which she can look down with those clear eyes at the poor mortals who pray to her. She seems to have what I never saw in any woman before-a fountain of friendship towards men-a man can make a friend of her. Casaubon must have raised some heroic hallucination in her. I won- der if she could have any other sort of passion for a man? Ladislaw?-there was certainly an unusual feeling between them. And Casaubon must have had a notion of it. Well-her love might help a man more than her money This content downloaded from 128.59.222.107 on Fri, 16 Sep
Middlemarch: (1648982, 1649704) like me." As Lydgate rode away, he thought This young creature has a heart large enough for the Virgin Mary. She evidently thinks nothing of her own future, and would pledge away half her income at once, as if she wanted nothing for herself but a chair to sit in from which she can look down with those clear eyes at the poor mortals who pray to her. She seems to have what I never saw in any woman before--a fountain of friendship towards men--a man can make a friend of her. Casaubon must have raised some heroic hallucination in her. I wonder if she could have any other sort of passion for a man? Ladislaw?--there was certainly an unusual feeling between them. And Casaubon must have had a notion of it. Well--her love might help a man more than her money Dorothea on her side had immediately formed a plan


match 14:
Adams: (50891, 51269) During her night watch in the cold room began now to live through that yesterday morning deliberately again, forcing herself to dwell on every detail and its possible meaning.... All the active thought with which she had before been representing to herself the trials of Lydgate's lot, and this young marriage union which, like her own, seemed to have its hidden as well as evident troubles-all this vivid sympathetic ex- perience returned to her now as a power: it asserted
Middlemarch: (1688955, 1690146) consciousness that only sees another's lot as an accident began now to live through that yesterday morning deliberately again, forcing herself to dwell on every detail and its possible meaning. Was she alone in that scene? Was it her event only? She forced herself to think of it as bound up with another woman's life--a woman towards whom she had set out with a longing to carry some clearness and comfort into her beclouded youth. In her first outleap of jealous indignation and disgust, when quitting the hateful room, she had flung away all the mercy with which she had undertaken that visit. She had enveloped both Will and Rosamond in her burning scorn, and it seemed to her as if Rosamond were burned out of her sight forever. But that base prompting which makes a women more cruel to a rival than to a faithless lover, could have no strength of recurrence in Dorothea when the dominant spirit of justice within her had once overcome the tumult and had once shown her the truer measure of things. All the active thought with which she had before been representing to herself the trials of Lydgate's lot, and this young marriage union which, like her own, seemed to have its hidden as well as evident troubles--all this vivid sympathetic experience returned to her now as a power: it asserted itself as acquired


match 15:
Adams: (51284, 51434) this vivid sympathetic ex- perience returned to her now as a power: it asserted itself as acquired knowledge asserts itself and will not let us see as we saw in the day of our ignorance this victory of knowledge over self
Middlemarch: (1690158, 1690307) all this vivid sympathetic experience returned to her now as a power: it asserted itself as acquired knowledge asserts itself and will not let us see as we saw in the day of our ignorance said to her own irremediable grief, that it should make her more


match 16:
Adams: (52743, 53140) BROOKE" TO MIDDLEMARCH 89 "Even if we loved someone else better than-than those we were married to, it would be no use.... I mean, marriage drinks up all our power of giving or getting any blessedness in that sort of love. I know it may be very dear-but it murders our marriageand then the marriage stays with us like a murder-and everything else is gone. And then our husband-if he loved and trusted us, and we have not helped him, but made a curse life . . . " (pp. 583-84) Here is the true reason for her overlong
Middlemarch: (1708843, 1709330) nearness it brings. Even if we loved some else better than--than those we were married to, it would be no use"--poor Dorothea, in her palpitating anxiety, could only seize her language brokenly--"I mean, marriage drinks up all our power of giving or getting any blessedness in that sort of love. I know it may be very dear--but it murders our marriage--and then the marriage stays with us like a murder--and everything else is gone. And then our husband--if he loved and trusted us, and we have not helped him, but made a curse life--" Her voice had sunk very low: there


match 17:
Adams: (52981, 53152) know it may be very dear-but it murders our marriageand marriage stays with us like a murder-and everything else is gone. And then our husband-if he loved and trusted us, and we have not helped him, but made a curse in his life pp. 583-84) Here is the true reason for her overlong mourning
Middlemarch: (1709168, 1709342) know it may be very dear--but it murders our marriage marriage stays with us like a murder--and everything else is gone. And then our husband--if he loved and trusted us, and we have not helped him, but made a curse in his life voice had sunk very low: there was a dread
Out[11]:
(17,
 [(12034, 12443),
  (12574, 12694),
  (13292, 13447),
  (14122, 14210),
  (15431, 15562),
  (32025, 32718),
  (37619, 37760),
  (38370, 38895),
  (40743, 40864),
  (45360, 45810),
  (45997, 46762),
  (48206, 48423),
  (49263, 49979),
  (50891, 51269),
  (51284, 51434),
  (52743, 53140),
  (52981, 53152)],
 [(5809, 6218),
  (8751, 8870),
  (8890, 9046),
  (57013, 57100),
  (83868, 83999),
  (116900, 117594),
  (192301, 192441),
  (195148, 195673),
  (402604, 402726),
  (411725, 412177),
  (449403, 450244),
  (1575265, 1576437),
  (1648982, 1649704),
  (1688955, 1690146),
  (1690158, 1690307),
  (1708843, 1709330),
  (1709168, 1709342)])