Main Content

이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.

파일에서 텍스트 데이터 추출하기

이 예제에서는 텍스트, HTML, Microsoft® Word, PDF, CSV 및 Microsoft Excel® 파일에서 텍스트 데이터를 추출한 다음 분석을 위해 MATLAB®으로 가져오는 방법을 보여줍니다.

일반적으로 텍스트 데이터를 MATLAB으로 가져오는 가장 쉬운 방법은 extractFileText 함수를 사용하는 것입니다. 이 함수는 텍스트, PDF, HTML 및 Microsoft Word 파일에서 텍스트 데이터를 추출합니다. CSV 및 Microsoft Excel 파일에서 텍스트를 가져오려면 readtable을 사용하십시오. HTML 코드에서 텍스트를 추출하려면 extractHTMLText를 사용하십시오. PDF 양식에서 데이터 읽어오려면 readPDFFormData를 사용하십시오.

텍스트 파일

extractFileText를 사용하여 sonnets.txt에서 텍스트를 추출합니다. sonnets.txt 파일에는 셰익스피어의 소네트가 일반 텍스트로 포함되어 있습니다.

filename = "sonnets.txt";
str = extractFileText(filename);

두 제목 "I" 및 "II" 사이의 텍스트를 추출하여 첫 번째 소네트를 표시합니다.

start = " I" + newline;
fin = " II";
sonnet1 = extractBetween(str,start,fin)
sonnet1 = 
    "
       From fairest creatures we desire increase,
       That thereby beauty's rose might never die,
       But as the riper should by time decease,
       His tender heir might bear his memory:
       But thou, contracted to thine own bright eyes,
       Feed'st thy light's flame with self-substantial fuel,
       Making a famine where abundance lies,
       Thy self thy foe, to thy sweet self too cruel:
       Thou that art now the world's fresh ornament,
       And only herald to the gaudy spring,
       Within thine own bud buriest thy content,
       And tender churl mak'st waste in niggarding:
         Pity the world, or else this glutton be,
         To eat the world's due, by the grave and thee.
     
      "

새 줄 문자로 구분된 여러 문서가 포함된 텍스트 파일의 경우 readlines 함수를 사용합니다.

filename = "multilineSonnets.txt";
str = readlines(filename)
str = 3×1 string
    "From fairest creatures we desire increase, That thereby beauty's rose might never die, But as the riper should by time decease, His tender heir might bear his memory: But thou, contracted to thine own bright eyes, Feed'st thy light's flame with self-substantial fuel, Making a famine where abundance lies, Thy self thy foe, to thy sweet self too cruel: Thou that art now the world's fresh ornament, And only herald to the gaudy spring, Within thine own bud buriest thy content, And tender churl mak'st waste in niggarding: Pity the world, or else this glutton be, To eat the world's due, by the grave and thee."
    "When forty winters shall besiege thy brow, And dig deep trenches in thy beauty's field, Thy youth's proud livery so gazed on now, Will be a tatter'd weed of small worth held: Then being asked, where all thy beauty lies, Where all the treasure of thy lusty days; To say, within thine own deep sunken eyes, Were an all-eating shame, and thriftless praise. How much more praise deserv'd thy beauty's use, If thou couldst answer 'This fair child of mine Shall sum my count, and make my old excuse,' Proving his beauty by succession thine! This were to be new made when thou art old, And see thy blood warm when thou feel'st it cold."
    "Look in thy glass and tell the face thou viewest Now is the time that face should form another; Whose fresh repair if now thou not renewest, Thou dost beguile the world, unbless some mother. For where is she so fair whose unear'd womb Disdains the tillage of thy husbandry? Or who is he so fond will be the tomb, Of his self-love to stop posterity? Thou art thy mother's glass and she in thee Calls back the lovely April of her prime; So thou through windows of thine age shalt see, Despite of wrinkles this thy golden time. But if thou live, remember'd not to be, Die single and thine image dies with thee."

Microsoft Word 문서

extractFileText를 사용하여 sonnets.docx에서 텍스트를 추출합니다. exampleSonnets.docx 파일에는 셰익스피어의 소네트가 Microsoft Word 문서로 포함되어 있습니다.

filename = "exampleSonnets.docx";
str = extractFileText(filename);

두 제목 "II" 및 "III" 사이의 텍스트를 추출하여 두 번째 소네트를 표시합니다.

start = " II" + newline;
fin = " III";
sonnet2 = extractBetween(str,start,fin)
sonnet2 = 
    "
     
     
       When forty winters shall besiege thy brow,
     
       And dig deep trenches in thy beauty's field,
     
       Thy youth's proud livery so gazed on now,
     
       Will be a tatter'd weed of small worth held:
     
       Then being asked, where all thy beauty lies,
     
       Where all the treasure of thy lusty days;
     
       To say, within thine own deep sunken eyes,
     
       Were an all-eating shame, and thriftless praise.
     
       How much more praise deserv'd thy beauty's use,
     
       If thou couldst answer 'This fair child of mine
     
       Shall sum my count, and make my old excuse,'
     
       Proving his beauty by succession thine!
     
         This were to be new made when thou art old,
     
         And see thy blood warm when thou feel'st it cold.
     
     
     
      "

예제 Microsoft Word 문서는 각 줄 사이에 2개의 새 줄 문자를 사용합니다. 이들 문자를 하나의 새 줄 문자로 바꾸기 위해 replace 함수를 사용합니다.

sonnet2 = replace(sonnet2,[newline newline],newline)
sonnet2 = 
    "
     
       When forty winters shall besiege thy brow,
       And dig deep trenches in thy beauty's field,
       Thy youth's proud livery so gazed on now,
       Will be a tatter'd weed of small worth held:
       Then being asked, where all thy beauty lies,
       Where all the treasure of thy lusty days;
       To say, within thine own deep sunken eyes,
       Were an all-eating shame, and thriftless praise.
       How much more praise deserv'd thy beauty's use,
       If thou couldst answer 'This fair child of mine
       Shall sum my count, and make my old excuse,'
       Proving his beauty by succession thine!
         This were to be new made when thou art old,
         And see thy blood warm when thou feel'st it cold.
     
      "

PDF 파일

PDF 문서에서 텍스트를 추출하고 PDF 양식에서 데이터를 추출합니다.

PDF 문서

extractFileText를 사용하여 sonnets.pdf에서 텍스트를 추출합니다. exampleSonnets.pdf 파일에는 셰익스피어의 소네트가 PDF로 포함되어 있습니다.

filename = "exampleSonnets.pdf";
str = extractFileText(filename);

두 제목 "III" 및 "IV" 사이의 텍스트를 추출하여 세 번째 소네트를 표시합니다. 이 PDF에는 각 새 줄 문자 앞에 공백이 하나씩 있습니다.

start = " III " + newline;
fin = "IV";
sonnet3 = extractBetween(str,start,fin)
sonnet3 = 
    " 
       Look in thy glass and tell the face thou viewest 
       Now is the time that face should form another; 
       Whose fresh repair if now thou not renewest, 
       Thou dost beguile the world, unbless some mother. 
       For where is she so fair whose unear'd womb 
       Disdains the tillage of thy husbandry? 
       Or who is he so fond will be the tomb, 
       Of his self-love to stop posterity? 
       Thou art thy mother's glass and she in thee 
       Calls back the lovely April of her prime; 
       So thou through windows of thine age shalt see, 
       Despite of wrinkles this thy golden time. 
         But if thou live, remember'd not to be, 
         Die single and thine image dies with thee. 
     
     
      
       "

PDF 양식

PDF 양식에서 텍스트 데이터를 읽어오려면 readPDFFormData를 사용합니다. 이 함수는 PDF 양식 필드의 데이터가 포함된 구조체를 반환합니다.

filename = "weatherReportForm1.pdf";
data = readPDFFormData(filename)
data = struct with fields:
         event_type: "Thunderstorm Wind"
    event_narrative: "Large tree down between Plantersville and Nettleton."

HTML

HTML 파일, HTML 코드 및 웹에서 텍스트를 추출합니다.

HTML 파일

저장된 HTML 파일에서 텍스트 데이터를 추출하려면 extractFileText를 사용합니다.

filename = "exampleSonnets.html";
str = extractFileText(filename);

두 제목 "IV""V" 사이의 텍스트를 추출하여 네 번째 소네트를 표시합니다.

start = newline + "IV" + newline;
fin = newline + "V" + newline;
sonnet4 = extractBetween(str,start,fin)
sonnet4 = 
    "
     Unthrifty loveliness, why dost thou spend
     Upon thy self thy beauty's legacy?
     Nature's bequest gives nothing, but doth lend,
     And being frank she lends to those are free:
     Then, beauteous niggard, why dost thou abuse
     The bounteous largess given thee to give?
     Profitless usurer, why dost thou use
     So great a sum of sums, yet canst not live?
     For having traffic with thy self alone,
     Thou of thy self thy sweet self dost deceive:
     Then how when nature calls thee to be gone,
     What acceptable audit canst thou leave?
     Thy unused beauty must be tombed with thee,
     Which, used, lives th' executor to be.
     "

HTML 코드

HTML 코드가 포함된 문자열에서 텍스트 데이터를 추출하려면 extractHTMLText를 사용합니다.

code = "<html><body><h1>THE SONNETS</h1><p>by William Shakespeare</p></body></html>";
str = extractHTMLText(code)
str = 
    "THE SONNETS
     
     by William Shakespeare"

웹 페이지에서 텍스트 데이터를 추출하려면 먼저 webread를 사용하여 HTML 코드를 읽어온 다음, extractHTMLText를 사용합니다.

url = "https://www.mathworks.com/help/textanalytics";
code = webread(url);
str = extractHTMLText(code)
str = 
    'Text Analytics Toolbox
     
     Analyze and model text data 
     
     Release Notes
     
     PDF Documentation
     
     Release Notes
     
     PDF Documentation
     
     Text Analytics Toolbox™ provides algorithms and visualizations for preprocessing, analyzing, and modeling text data. Models created with the toolbox can be used in applications such as sentiment analysis, predictive maintenance, and topic modeling.
     
     Text Analytics Toolbox includes tools for processing raw text from sources such as equipment logs, news feeds, surveys, operator reports, and social media. You can extract text from popular file formats, preprocess raw text, extract individual words, convert text into numerical representations, and build statistical models.
     
     Using machine learning techniques such as LSA, LDA, and word embeddings, you can find clusters and create features from high-dimensional text datasets. Features created with Text Analytics Toolbox can be combined with features from other data sources to build machine learning models that take advantage of textual, numeric, and other types of data.
     
     Get Started
     
     Learn the basics of Text Analytics Toolbox
     
     Text Data Preparation
     
     Import text data into MATLAB® and preprocess it for analysis
     
     Modeling and Prediction
     
     Develop predictive models using topic models and word embeddings
     
     Display and Presentation
     
     Visualize text data and models using word clouds and text scatter plots
     
     Language Support
     
     Information on language support in Text Analytics Toolbox'

HTML 코드 구문 분석하기

HTML 코드의 특정 요소를 찾으려면 htmlTree를 사용하여 코드를 구문 분석한 후 findElement를 사용합니다. HTML 코드를 구문 분석하고 하이퍼링크를 모두 찾습니다. 하이퍼링크는 요소 이름이 "A"인 노드입니다.

tree = htmlTree(code);
selector = "A";
subtrees = findElement(tree,selector);

처음 10개의 하위 트리를 표시하고 extractHTMLText를 사용하여 텍스트를 추출합니다.

subtrees(1:10)
ans = 
  10×1 htmlTree:

    <A class="skip_link sr-only" href="#content_container">Skip to content</A>
    <A href="https://www.mathworks.com?s_tid=gn_logo" class="svg_link navbar-brand"><IMG src="/images/responsive/global/pic-header-mathworks-logo.svg" class="mw_logo" alt="MathWorks"/></A>
    <A href="https://www.mathworks.com/products.html?s_tid=gn_ps">Products</A>
    <A href="https://www.mathworks.com/solutions.html?s_tid=gn_sol">Solutions</A>
    <A href="https://www.mathworks.com/academia.html?s_tid=gn_acad">Academia</A>
    <A href="https://www.mathworks.com/support.html?s_tid=gn_supp">Support</A>
    <A href="https://www.mathworks.com/matlabcentral/?s_tid=gn_mlc">Community</A>
    <A href="https://www.mathworks.com/company/events.html?s_tid=gn_ev">Events</A>
    <A href="https://www.mathworks.com/products/get-matlab.html?s_tid=gn_getml">Get MATLAB</A>
    <A href="https://www.mathworks.com?s_tid=gn_logo" class="svg_link pull-left"><IMG src="/images/responsive/global/pic-header-mathworks-logo.svg" class="mw_logo" alt="MathWorks"/></A>

str = extractHTMLText(subtrees);

처음 10개 하이퍼링크의 추출된 텍스트를 표시합니다.

str(1:10)
ans = 10×1 string
    "Skip to content"
    ""
    "Products"
    "Solutions"
    "Academia"
    "Support"
    "Community"
    "Events"
    "Get MATLAB"
    ""

링크 대상을 가져오려면 getAttributes를 사용하여 특성 "href"(하이퍼링크 참조)를 지정합니다. 처음 10개 하위 트리의 링크 대상을 가져옵니다.

attr = "href";
str = getAttribute(subtrees(1:10),attr)
str = 10×1 string
    "#content_container"
    "https://www.mathworks.com?s_tid=gn_logo"
    "https://www.mathworks.com/products.html?s_tid=gn_ps"
    "https://www.mathworks.com/solutions.html?s_tid=gn_sol"
    "https://www.mathworks.com/academia.html?s_tid=gn_acad"
    "https://www.mathworks.com/support.html?s_tid=gn_supp"
    "https://www.mathworks.com/matlabcentral/?s_tid=gn_mlc"
    "https://www.mathworks.com/company/events.html?s_tid=gn_ev"
    "https://www.mathworks.com/products/get-matlab.html?s_tid=gn_getml"
    "https://www.mathworks.com?s_tid=gn_logo"

CSV 및 Microsoft Excel 파일

CSV 및 Microsoft Excel 파일에서 텍스트 데이터를 추출하려면 readtable 함수를 사용하고 이 함수에서 반환되는 테이블에서 텍스트 데이터를 추출합니다.

readtable 함수를 사용하여 factoryReposts.csv에서 텍스트 데이터를 추출하고 테이블의 처음 몇 개의 행을 표시합니다.

T = readtable('factoryReports.csv','TextType','string');
head(T)
ans=8×5 table
                                 Description                                       Category          Urgency          Resolution         Cost 
    _____________________________________________________________________    ____________________    ________    ____________________    _____

    "Items are occasionally getting stuck in the scanner spools."            "Mechanical Failure"    "Medium"    "Readjust Machine"         45
    "Loud rattling and banging sounds are coming from assembler pistons."    "Mechanical Failure"    "Medium"    "Readjust Machine"         35
    "There are cuts to the power when starting the plant."                   "Electronic Failure"    "High"      "Full Replacement"      16200
    "Fried capacitors in the assembler."                                     "Electronic Failure"    "High"      "Replace Components"      352
    "Mixer tripped the fuses."                                               "Electronic Failure"    "Low"       "Add to Watch List"        55
    "Burst pipe in the constructing agent is spraying coolant."              "Leak"                  "High"      "Replace Components"      371
    "A fuse is blown in the mixer."                                          "Electronic Failure"    "Low"       "Replace Components"      441
    "Things continue to tumble off of the belt."                             "Mechanical Failure"    "Low"       "Readjust Machine"         38

event_narrative 열에서 텍스트 데이터를 추출한 다음, 처음 몇 개의 문자열을 표시합니다.

str = T.Description;
str(1:10)
ans = 10×1 string
    "Items are occasionally getting stuck in the scanner spools."
    "Loud rattling and banging sounds are coming from assembler pistons."
    "There are cuts to the power when starting the plant."
    "Fried capacitors in the assembler."
    "Mixer tripped the fuses."
    "Burst pipe in the constructing agent is spraying coolant."
    "A fuse is blown in the mixer."
    "Things continue to tumble off of the belt."
    "Falling items from the conveyor belt."
    "The scanner reel is split, it will soon begin to curve."

여러 파일에서 텍스트 추출하기

텍스트 데이터가 한 폴더 내 여러 파일에 포함되어 있는 경우 파일 데이터저장소를 사용하여 텍스트 데이터를 MATLAB으로 가져올 수 있습니다.

예제 소네트 텍스트 파일을 위한 파일 데이터저장소를 만듭니다. 예제 파일의 이름은 "exampleSonnetN.txt"이며, 여기서 N은 소네트의 번호입니다. 와일드카드 "*"로 파일 이름을 지정하여 이 구조로 된 파일 이름을 모두 찾습니다. extractFileText를 읽기 함수로 지정하려면 함수 핸들을 사용하여 이 함수를 fileDatastore에 입력합니다.

location = fullfile(matlabroot,"examples","textanalytics","data","exampleSonnet*.txt");
fds = fileDatastore(location,'ReadFcn',@extractFileText)
fds = 
  FileDatastore with properties:

                       Files: {
                              ' ...\matlab\examples\textanalytics\data\exampleSonnet1.txt';
                              ' ...\matlab\examples\textanalytics\data\exampleSonnet2.txt';
                              ' ...\matlab\examples\textanalytics\data\exampleSonnet3.txt'
                               ... and 2 more
                              }
                     Folders: {
                              ' ...\matlab\examples\textanalytics\data'
                              }
                 UniformRead: 0
                    ReadMode: 'file'
                   BlockSize: Inf
                  PreviewFcn: @extractFileText
      SupportedOutputFormats: ["txt"    "csv"    "xlsx"    "xls"    "parquet"    "parq"    "png"    "jpg"    "jpeg"    "tif"    "tiff"    "wav"    "flac"    "ogg"    "mp4"    "m4a"]
                     ReadFcn: @extractFileText
    AlternateFileSystemRoots: {}

루프를 사용해 데이터저장소에 있는 파일을 순회하여 각 텍스트 파일을 읽어옵니다.

str = [];
while hasdata(fds)
    textData = read(fds);
    str = [str; textData];
end

추출된 텍스트를 표시합니다.

str
str = 5×1 string
    "  From fairest creatures we desire increase,↵  That thereby beauty's rose might never die,↵  But as the riper should by time decease,↵  His tender heir might bear his memory:↵  But thou, contracted to thine own bright eyes,↵  Feed'st thy light's flame with self-substantial fuel,↵  Making a famine where abundance lies,↵  Thy self thy foe, to thy sweet self too cruel:↵  Thou that art now the world's fresh ornament,↵  And only herald to the gaudy spring,↵  Within thine own bud buriest thy content,↵  And tender churl mak'st waste in niggarding:↵    Pity the world, or else this glutton be,↵    To eat the world's due, by the grave and thee."
    "  When forty winters shall besiege thy brow,↵  And dig deep trenches in thy beauty's field,↵  Thy youth's proud livery so gazed on now,↵  Will be a tatter'd weed of small worth held:↵  Then being asked, where all thy beauty lies,↵  Where all the treasure of thy lusty days;↵  To say, within thine own deep sunken eyes,↵  Were an all-eating shame, and thriftless praise.↵  How much more praise deserv'd thy beauty's use,↵  If thou couldst answer 'This fair child of mine↵  Shall sum my count, and make my old excuse,'↵  Proving his beauty by succession thine!↵    This were to be new made when thou art old,↵    And see thy blood warm when thou feel'st it cold."
    "  Look in thy glass and tell the face thou viewest↵  Now is the time that face should form another;↵  Whose fresh repair if now thou not renewest,↵  Thou dost beguile the world, unbless some mother.↵  For where is she so fair whose unear'd womb↵  Disdains the tillage of thy husbandry?↵  Or who is he so fond will be the tomb,↵  Of his self-love to stop posterity?↵  Thou art thy mother's glass and she in thee↵  Calls back the lovely April of her prime;↵  So thou through windows of thine age shalt see,↵  Despite of wrinkles this thy golden time.↵    But if thou live, remember'd not to be,↵    Die single and thine image dies with thee."
    "  Unthrifty loveliness, why dost thou spend↵  Upon thy self thy beauty's legacy?↵  Nature's bequest gives nothing, but doth lend,↵  And being frank she lends to those are free:↵  Then, beauteous niggard, why dost thou abuse↵  The bounteous largess given thee to give?↵  Profitless usurer, why dost thou use↵  So great a sum of sums, yet canst not live?↵  For having traffic with thy self alone,↵  Thou of thy self thy sweet self dost deceive:↵  Then how when nature calls thee to be gone,↵  What acceptable audit canst thou leave?↵    Thy unused beauty must be tombed with thee,↵    Which, used, lives th' executor to be."
    "from fairest creatures we desire increase that thereby beautys rose might never die but as the riper should by time decease his tender heir might bear his memory but thou contracted to thine own bright eyes feedst thy lights flame with selfsubstantial fuel making a famine where abundance lies thy self thy foe to thy sweet self too cruel thou that art now the worlds fresh ornament and only herald to the gaudy spring within thine own bud buriest thy content and tender churl makst waste in niggarding pity the world or else this glutton be to eat the worlds due by the grave and thee↵when forty winters shall besiege thy brow and dig deep trenches in thy beautys field thy youths proud livery so gazed on now will be a tatterd weed of small worth held then being asked where all thy beauty lies where all the treasure of thy lusty days to say within thine own deep sunken eyes were an alleating shame and thriftless praise how much more praise deservd thy beautys use if thou couldst answer this fair child of mine shall sum my count and make my old excuse proving his beauty by succession thine this were to be new made when thou art old and see thy blood warm when thou feelst it cold↵look in thy glass and tell the face thou viewest now is the time that face should form another whose fresh repair if now thou not renewest thou dost beguile the world unbless some mother for where is she so fair whose uneard womb disdains the tillage of thy husbandry or who is he so fond will be the tomb of his selflove to stop posterity thou art thy mothers glass and she in thee calls back the lovely april of her prime so thou through windows of thine age shalt see despite of wrinkles this thy golden time but if thou live rememberd not to be die single and thine image dies with thee↵unthrifty loveliness why dost thou spend upon thy self thy beautys legacy natures bequest gives nothing but doth lend and being frank she lends to those are free then beauteous niggard why dost thou abuse the bounteous largess given thee to give profitless usurer why dost thou use so great a sum of sums yet canst not live for having traffic with thy self alone thou of thy self thy sweet self dost deceive then how when nature calls thee to be gone what acceptable audit canst thou leave thy unused beauty must be tombed with thee which used lives th executor to be↵those hours that with gentle work did frame the lovely gaze where every eye doth dwell will play the tyrants to the very same and that unfair which fairly doth excel for neverresting time leads summer on to hideous winter and confounds him there sap checked with frost and lusty leaves quite gone beauty oersnowed and bareness every where then were not summers distillation left a liquid prisoner pent in walls of glass beautys effect with beauty were bereft nor it nor no remembrance what it was but flowers distilld though they with winter meet leese but their show their substance still lives sweet↵then let not winters ragged hand deface in thee thy summer ere thou be distilld make sweet some vial treasure thou some place with beautys treasure ere it be selfkilld that use is not forbidden usury which happies those that pay the willing loan thats for thy self to breed another thee or ten times happier be it ten for one ten times thy self were happier than thou art if ten of thine ten times refigurd thee then what could death do if thou shouldst depart leaving thee living in posterity be not selfwilld for thou art much too fair to be deaths conquest and make worms thine heir↵lo in the orient when the gracious light lifts up his burning head each under eye doth homage to his newappearing sight serving with looks his sacred majesty and having climbd the steepup heavenly hill resembling strong youth in his middle age yet mortal looks adore his beauty still attending on his golden pilgrimage but when from highmost pitch with weary car like feeble age he reeleth from the day the eyes fore duteous now converted are from his low tract and look another way so thou thyself outgoing in thy noon unlookd on diest unless thou get a son↵music to hear why hearst thou music sadly sweets with sweets war not joy delights in joy why lovst thou that which thou receivst not gladly or else receivst with pleasure thine annoy if the true concord of welltuned sounds by unions married do offend thine ear they do but sweetly chide thee who confounds in singleness the parts that thou shouldst bear mark how one string sweet husband to another strikes each in each by mutual ordering resembling sire and child and happy mother who all in one one pleasing note do sing whose speechless song being many seeming one sings this to thee thou single wilt prove none↵is it for fear to wet a widows eye that thou consumst thy self in single life ah if thou issueless shalt hap to die the world will wail thee like a makeless wife the world will be thy widow and still weep that thou no form of thee hast left behind when every private widow well may keep by childrens eyes her husbands shape in mind look what an unthrift in the world doth spend shifts but his place for still the world enjoys it but beautys waste hath in the world an end and kept unused the user so destroys it no love toward others in that bosom sits that on himself such murdrous shame commits↵for shame deny that thou bearst love to any who for thy self art so unprovident grant if thou wilt thou art belovd of many but that thou none lovst is most evident for thou art so possessd with murderous hate that gainst thy self thou stickst not to conspire seeking that beauteous roof to ruinate which to repair should be thy chief desire o change thy thought that i may change my mind shall hate be fairer lodgd than gentle love be as thy presence is gracious and kind or to thyself at least kindhearted prove make thee another self for love of me that beauty still may live in thine or thee↵as fast as thou shalt wane so fast thou growst in one of thine from that which thou departest and that fresh blood which youngly thou bestowst thou mayst call thine when thou from youth convertest herein lives wisdom beauty and increase without this folly age and cold decay if all were minded so the times should cease and threescore year would make the world away let those whom nature hath not made for store harsh featureless and rude barrenly perish look whom she best endowd she gave thee more which bounteous gift thou shouldst in bounty cherish she carvd thee for her seal and meant thereby thou shouldst print more not let that copy die↵when i do count the clock that tells the time and see the brave day sunk in hideous night when i behold the violet past prime and sable curls all silvered oer with white when lofty trees i see barren of leaves which erst from heat did canopy the herd and summers green all girded up in sheaves borne on the bier with white and bristly beard then of thy beauty do i question make that thou among the wastes of time must go since sweets and beauties do themselves forsake and die as fast as they see others grow and nothing gainst times scythe can make defence save breed to brave him when he takes thee hence↵o that you were your self but love you are no longer yours than you your self here live against this coming end you should prepare and your sweet semblance to some other give so should that beauty which you hold in lease find no determination then you were yourself again after yourselfs decease when your sweet issue your sweet form should bear who lets so fair a house fall to decay which husbandry in honour might uphold against the stormy gusts of winters day and barren rage of deaths eternal cold o none but unthrifts dear my love you know you had a father let your son say so↵not from the stars do i my judgement pluck and yet methinks i have astronomy but not to tell of good or evil luck of plagues of dearths or seasons quality nor can i fortune to brief minutes tell pointing to each his thunder rain and wind or say with princes if it shall go well by oft predict that i in heaven find but from thine eyes my knowledge i derive and constant stars in them i read such art as truth and beauty shall together thrive if from thyself to store thou wouldst convert or else of thee this i prognosticate thy end is truths and beautys doom and date↵when i consider every thing that grows holds in perfection but a little moment that this huge stage presenteth nought but shows whereon the stars in secret influence comment when i perceive that men as plants increase cheered and checked even by the selfsame sky vaunt in their youthful sap at height decrease and wear their brave state out of memory then the conceit of this inconstant stay sets you most rich in youth before my sight where wasteful time debateth with decay to change your day of youth to sullied night and all in war with time for love of you as he takes from you i engraft you new↵but wherefore do not you a mightier way make war upon this bloody tyrant time and fortify your self in your decay with means more blessed than my barren rhyme now stand you on the top of happy hours and many maiden gardens yet unset with virtuous wish would bear you living flowers much liker than your painted counterfeit so should the lines of life that life repair which this times pencil or my pupil pen neither in inward worth nor outward fair can make you live your self in eyes of men to give away yourself keeps yourself still and you must live drawn by your own sweet skill↵who will believe my verse in time to come if it were filld with your most high deserts though yet heaven knows it is but as a tomb which hides your life and shows not half your parts if i could write the beauty of your eyes and in fresh numbers number all your graces the age to come would say this poet lies such heavenly touches neer touchd earthly faces so should my papers yellowd with their age be scornd like old men of less truth than tongue and your true rights be termd a poets rage and stretched me…"

참고 항목

| | |

관련 항목