Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - PoliMi

Pages: [1]
1
Programs / Text Corrector
« on: October 12, 2021, 04:24:29 pm »
Text Corrector corrects writing errors while the user is composing a text. It doesn't require a vocabulary file, instead it learns any language from a given sample text. The algorithm not only extracts the words from that sample, but it also extracts the links between words and analyzes the probabilistic features of the language. Basing on the collected data, typing errors are then modeled as gaussian distributions which mean is the right value.

While the user is typing a new word, in order to predict which word the user intends to write, the algorithm evaluates vocabulary words affinity, which is a weighted mean of three parameters:
- LENGTH(i): the probabilistic distance between the length of the typed word and the length of the i-th vocabulary word
- CONTEXT(i): the estimated frequency that, given one last typed word, the i-th vocabulary word follows
- STRUCTURE(i, j): the probabilistic distance of the j-th letter of the typed word from the j-th position in the i-th vocabulary word

To enhance prediction performance, the algorithm recalibrates these parameters with two further correction mechanisms:
- BIAS: the weight of the LENGTH parameter is reduced while few letters have been typed, since with few letters typed it's probable that length is not definitive (i.e., that more letters will be typed, and length will soon increase)
- BONUS: if the exact typed word exists in the vocabulary, its affinity is brought to the maximum, so that it prevails on all other vocabulary words.

Even though in order to fully work the algorithm needs a long and complete text sample that is representative of the language, the default sample hard-coded in the program can already show a good example of its predictive behavior.

Code: QB64: [Select]
  1. _Title "Text Corrector"
  2. Common Shared L: L = 100000 + 1 ' max number of links + 1
  3. Dim Shared numWords As Integer
  4. Dim Shared numLinks As Integer
  5. Dim Shared numCountedLinks As Integer
  6. Dim Shared numSearchedCountedLinks As Integer
  7. Dim Shared totSearchedCountedLinks As Integer
  8. Dim Shared links(L, 2) As String
  9. Dim Shared countedLinks(L, 3) As String
  10. Dim Shared searchedCountedLinks(L, 3) As String
  11. Dim Shared words(L) As String
  12. Dim Shared wordsProbability(L, 4) As Double ' 1) LENGTH   2) CONTEXT   3) STRUCTURE   4) GLOBAL
  13. Dim Shared GaussTable(0 To 400) As Double: fillGaussTable
  14.  
  15. If _FileExists("sample.txt") Then
  16.     Open "sample.txt" For Input As #1
  17.     Do Until EOF(1)
  18.         Line Input #1, temp$
  19.         sample$ = sample$ + temp$ + " "
  20.     Loop
  21.     Close #1
  22.     sample$ = "Today is a beautiful day, tomorrow I'm going to the park. The park is far from home, so today I will stay at home or maybe I will go to the supermarket. By the way, your house is beautiful and big, I really like it!"
  23.  
  24. lastArchivedWord$ = "."
  25. isFirstTime = -1
  26. lastInputWasPunctuation = 0
  27. learnFromSample (sample$)
  28.     If Not key$ = "" Or isFirstTime Then
  29.         isFirstTime = 0
  30.         bias1 = 0.10 / (2 ^ (1 * Len(newWord$))) ' with few letters context >> length
  31.         bias2 = 0.05 / (2 ^ (1 * Len(newWord$))) ' with few letters structure >> length
  32.         computeWordAffinity lastArchivedWord$, newWord$, 0.15 - bias1 - bias2, 0.30 + bias1, 0.55 + bias2, 1
  33.         refreshTextEditor archivedText$, lastArchivedWord$, newWord$
  34.     End If
  35.  
  36.     key$ = LCase$(InKey$): _Limit 20
  37.     If Not key$ = "" Then
  38.         If isPunctuation(key$) Then
  39.             archivedText$ = archivedText$ + " " + lastArchivedWord$ + " "
  40.             If newWord$ = "" Then
  41.                 archivedText$ = archivedText$ + " "
  42.             Else
  43.                 archivedText$ = archivedText$ + " " + highestAffinityWord$ + " "
  44.                 newWord$ = ""
  45.             End If
  46.             lastArchivedWord$ = key$
  47.             lastInputWasPunctuation = -1
  48.         Else
  49.             Select Case key$
  50.                 Case " ":
  51.                     If Not lastInputWasPunctuation Then
  52.                         archivedText$ = archivedText$ + " " + lastArchivedWord$ + " "
  53.                         If isPunctuation(newWord$) Then
  54.                             lastArchivedWord$ = newWord$
  55.                         Else
  56.                             lastArchivedWord$ = highestAffinityWord$
  57.                         End If
  58.                         newWord$ = ""
  59.                     Else
  60.                         lastInputWasPunctuation = 0
  61.                         key$ = ""
  62.                     End If
  63.                 Case Chr$(8):
  64.                     If Not Len(newWord$) = 0 Then
  65.                         newWord$ = Left$(newWord$, Len(newWord$) - 1)
  66.                     Else
  67.                         key$ = ""
  68.                     End If
  69.                 Case Chr$(13): key$ = ""
  70.                 Case Chr$(27): System
  71.                 Case Else:
  72.                     newWord$ = newWord$ + key$
  73.                     lastInputWasPunctuation = 0
  74.             End Select
  75.         End If
  76.     End If
  77.  
  78.  
  79.  
  80.  
  81. Sub refreshTextEditor (archivedText$, lastArchivedWord$, newWord$)
  82.     showComputedWordAffinity
  83.     toprint$ = archivedText$
  84.     If Not isPunctuation(lastArchivedWord$) Then toprint$ = toprint$ + " "
  85.     toprint$ = toprint$ + lastArchivedWord$
  86.     If Not isPunctuation(newWord$) Then toprint$ = toprint$ + " "
  87.     toprint$ = toprint$ + newWord$ + "_"
  88.     showText destandardize$(Right$(toprint$, Len(toprint$) - 2), -1), Len(newWord$), -1
  89.     _Display
  90.  
  91. Sub showText (text$, numOfFinalCharsToColor, colorFinalChar)
  92.     Do While Len(text$) > 80 * 10
  93.         text$ = Right$(text$, Len(text$) - 80)
  94.     Loop
  95.     Color 7: Locate 1, 1
  96.     Print "Write something, I'll try to correct you:"
  97.     Color 15: Locate 2, 1
  98.     line$ = ""
  99.     For I = 1 To Len(text$)
  100.         line$ = line$ + Mid$(text$, I, 1)
  101.         If I = Len(text$) - numOfFinalCharsToColor Then Color 13
  102.         If colorFinalChar And I = Len(text$) Then Color 7
  103.         Print Mid$(text$, I, 1);
  104.         If Len(line$) >= 80 Or I = Len(text$) Then line$ = "": Print
  105.     Next I
  106.  
  107. Sub showComputedWordAffinity
  108.     best$ = highestAffinityWord$
  109.     Cls: Locate 13, 1: Color 8
  110.     Print "WORD", "LENGTH", "CONTEXT", "STRUCTURE", "GLOBAL"
  111.     For i = 1 To min(numWords, 10)
  112.         If words(i) = best$ Then Color 15
  113.         If Not isSpecial(words(i)) Then
  114.             If Len(words(i)) > 12 Then
  115.                 Print Left$(words(i), 11); " ",
  116.             Else
  117.                 Print words(i); " ",
  118.             End If
  119.             Print Int(wordsProbability(i, 1) * 100); "%   ", Int(wordsProbability(i, 2) * 100); "%   ", Int(wordsProbability(i, 3) * 100); "%   ", max(Int(wordsProbability(i, 4) * 100), 0); "%"
  120.         End If
  121.         If words(i) = best$ Then Color 8
  122.     Next i
  123.  
  124. Function highestAffinityWord$
  125.     For I = 1 To numWords
  126.         If Not isSpecial(words(I)) Then
  127.             highestAffinityWord$ = words(I)
  128.             Exit For
  129.         End If
  130.     Next I
  131.  
  132. Sub learnFromSample (sample$)
  133.     decomposeIntoLinks (sample$)
  134.     orderLinks
  135.     countLinks
  136.     collectWords
  137.  
  138. Sub computeWordAffinity (oldword$, newWord$, A, B, C, BONUS) ' A = length weight, B = context weight, C = structure weight, BONUS = value added to global probability (constraint: A + B + C = 1)
  139.     For I = 1 To numWords
  140.         wordsProbability(I, 1) = 0
  141.         wordsProbability(I, 2) = 0
  142.         wordsProbability(I, 3) = 0
  143.         wordsProbability(I, 1) = probability(Len(newWord$), Len(words(I))) / probability(0, 0)
  144.         wordsProbability(I, 3) = structureLikeness(newWord$, words(I))
  145.     Next I
  146.     searchLinks (oldword$)
  147.     For I = 1 To numSearchedCountedLinks
  148.         position = wordPosition(searchedCountedLinks(I, 2))
  149.         wordsProbability(position, 2) = Val(searchedCountedLinks(I, 3)) / totSearchedCountedLinks
  150.     Next I
  151.     For I = 1 To numWords
  152.         wordsProbability(I, 4) = Int((A * wordsProbability(I, 1) + B * wordsProbability(I, 2) + C * wordsProbability(I, 3)) * 10 ^ 4) / 10 ^ 4
  153.         If wordsProbability(I, 1) = 1 And wordsProbability(I, 3) = 1 Then wordsProbability(I, 4) = min(1, wordsProbability(I, 4) + BONUS)
  154.     Next I
  155.     orderComputedWords
  156.     shuffleWords
  157.  
  158. Sub orderComputedWords
  159.     Do
  160.         changed = 0
  161.         For I = 2 To numWords
  162.             If wordsProbability(I, 4) > wordsProbability(I - 1, 4) Then
  163.                 buffer$ = words(I - 1)
  164.                 buffer1 = wordsProbability(I - 1, 1)
  165.                 buffer2 = wordsProbability(I - 1, 2)
  166.                 buffer3 = wordsProbability(I - 1, 3)
  167.                 buffer4 = wordsProbability(I - 1, 4)
  168.                 words(I - 1) = words(I)
  169.                 wordsProbability(I - 1, 1) = wordsProbability(I, 1)
  170.                 wordsProbability(I - 1, 2) = wordsProbability(I, 2)
  171.                 wordsProbability(I - 1, 3) = wordsProbability(I, 3)
  172.                 wordsProbability(I - 1, 4) = wordsProbability(I, 4)
  173.                 words(I) = buffer$
  174.                 wordsProbability(I, 1) = buffer1
  175.                 wordsProbability(I, 2) = buffer2
  176.                 wordsProbability(I, 3) = buffer3
  177.                 wordsProbability(I, 4) = buffer4
  178.                 changed = 1
  179.             End If
  180.         Next I
  181.     Loop Until changed = 0
  182.  
  183. Sub shuffleWords
  184.     For I = 2 To numWords
  185.         If wordsProbability(I, 4) = wordsProbability(I - 1, 4) Then
  186.             buffer$ = words(I - 1)
  187.             buffer1 = wordsProbability(I - 1, 1)
  188.             buffer2 = wordsProbability(I - 1, 2)
  189.             buffer3 = wordsProbability(I - 1, 3)
  190.             buffer4 = wordsProbability(I - 1, 4)
  191.             words(I - 1) = words(I)
  192.             wordsProbability(I - 1, 1) = wordsProbability(I, 1)
  193.             wordsProbability(I - 1, 2) = wordsProbability(I, 2)
  194.             wordsProbability(I - 1, 3) = wordsProbability(I, 3)
  195.             wordsProbability(I - 1, 4) = wordsProbability(I, 4)
  196.             words(I) = buffer$
  197.             wordsProbability(I, 1) = buffer1
  198.             wordsProbability(I, 2) = buffer2
  199.             wordsProbability(I, 3) = buffer3
  200.             wordsProbability(I, 4) = buffer4
  201.         End If
  202.     Next I
  203.  
  204. Function wordPosition (searchedWord$)
  205.     For I = 1 To numWords
  206.         If words(I) = searchedWord$ Then
  207.             wordPosition = I
  208.             Exit For
  209.         End If
  210.     Next I
  211.  
  212. Sub collectWords
  213.     oldstr$ = countedLinks(1, 1)
  214.     j = 1
  215.     For i = 2 To numCountedLinks
  216.         If Not countedLinks(i, 1) = oldstr$ Then
  217.             If Not isSpecial(oldstr$) Then
  218.                 words(j) = oldstr$
  219.                 j = j + 1
  220.             End If
  221.             oldstr$ = countedLinks(i, 1)
  222.         End If
  223.     Next i
  224.     If Not isSpecial(oldstr$) Then
  225.         words(j) = oldstr$
  226.         numWords = j
  227.     Else
  228.         numWords = j - 1
  229.     End If
  230.  
  231. Function structureLikeness (myWord$, vocabularyWord$)
  232.     Dim totDistance As Double: totDistance = 0
  233.     For I = 1 To Len(myWord$)
  234.         distance = charDistance(Mid$(myWord$, I, 1), vocabularyWord$, I)
  235.         totDistance = totDistance + probability(distance, 0)
  236.     Next I
  237.     If Len(myWord$) = 0 Then
  238.         structureLikeness = 0
  239.     Else
  240.         structureLikeness = totDistance / (Len(myWord$) * probability(0, 0))
  241.     End If
  242.  
  243. Sub searchLinks (keyword$)
  244.     For I = 1 To numCountedLinks
  245.         searchedCountedLinks(I, 1) = ""
  246.         searchedCountedLinks(I, 2) = ""
  247.         searchedCountedLinks(I, 3) = ""
  248.     Next I
  249.     j = 0
  250.     totSearchedCountedLinks = 0
  251.     For I = 1 To numCountedLinks
  252.         If countedLinks(I, 1) = keyword$ Then
  253.             j = j + 1
  254.             searchedCountedLinks(j, 1) = countedLinks(I, 1)
  255.             searchedCountedLinks(j, 2) = countedLinks(I, 2)
  256.             searchedCountedLinks(j, 3) = countedLinks(I, 3)
  257.             totSearchedCountedLinks = totSearchedCountedLinks + Val(countedLinks(I, 3))
  258.         End If
  259.     Next I
  260.     numSearchedCountedLinks = j
  261.  
  262. Sub countLinks
  263.     oldstr1$ = links(1, 1)
  264.     oldstr2$ = links(1, 2)
  265.     counter = 1
  266.     j = 1
  267.     For I = 2 To numLinks
  268.         If links(I, 1) = oldstr1$ And links(I, 2) = oldstr2$ Then
  269.             counter = counter + 1
  270.         Else
  271.             countedLinks(j, 1) = oldstr1$
  272.             countedLinks(j, 2) = oldstr2$
  273.             countedLinks(j, 3) = Str$(counter)
  274.             oldstr1$ = links(I, 1)
  275.             oldstr2$ = links(I, 2)
  276.             j = j + 1
  277.             counter = 1
  278.         End If
  279.     Next I
  280.     countedLinks(j, 1) = oldstr1$
  281.     countedLinks(j, 2) = oldstr2$
  282.     countedLinks(j, 3) = Str$(counter)
  283.     numCountedLinks = j
  284.  
  285. Sub decomposeIntoLinks (sample$)
  286.     sample$ = standardize$(sample$)
  287.     Dim oldword As String
  288.     Dim newword As String
  289.     Dim extractedword As String
  290.     For I = 1 To Len(sample$)
  291.         j = InStr(I, sample$, " ")
  292.         If j = 0 Then Exit For
  293.         extractedword = Mid$(sample$, I - 1, j - I + 1)
  294.         If Len(extracted) > 0 Then
  295.             oldword = newword
  296.             newword = extractedword
  297.             If Not I = 1 Then
  298.                 row = row + 1
  299.                 links(row, 1) = _Trim$(oldword)
  300.                 links(row, 2) = _Trim$(newword)
  301.             End If
  302.         End If
  303.         I = j + 1
  304.     Next I
  305.     numLinks = row
  306.  
  307. Sub orderLinks
  308.     Do
  309.         changed = 0
  310.         For I = 2 To numLinks
  311.             result = compare(links(I - 1, 1) + Chr$(255) + links(I - 1, 2), links(I, 1) + Chr$(255) + links(I, 2))
  312.             If result = 2 Then
  313.                 buffer1$ = links(I - 1, 1)
  314.                 buffer2$ = links(I - 1, 2)
  315.                 links(I - 1, 1) = links(I, 1)
  316.                 links(I - 1, 2) = links(I, 2)
  317.                 links(I, 1) = buffer1$
  318.                 links(I, 2) = buffer2$
  319.                 changed = 1
  320.             End If
  321.         Next I
  322.     Loop Until changed = 0
  323.  
  324. Function standardize$ (sample$)
  325.     sample$ = "." + _Trim$(LCase$(sample$)) + ". "
  326.     For i = 1 To Len(sample$)
  327.         char$ = Mid$(sample$, i, 1)
  328.         If isUnsupported(char$) Then char$ = " "
  329.         If isPunctuation(char$) Then char$ = " " + char$ + " "
  330.         standardize$ = standardize$ + char$
  331.     Next i
  332.  
  333. Function destandardize$ (sample$, uppercase)
  334.     If uppercase Then
  335.         sample$ = UCase$(Left$(_Trim$(sample$), 1)) + Right$(_Trim$(sample$), Len(_Trim$(sample$)) - 1)
  336.     Else
  337.         sample$ = _Trim$(sample$)
  338.     End If
  339.     For i = 1 To Len(sample$)
  340.         char$ = Mid$(sample$, i, 1)
  341.         nextchar$ = Mid$(sample$, i + 1, 1)
  342.         If char$ = " " And isPunctuation(nextchar$) Then
  343.         ElseIf char$ = " " And nextchar$ = " " Then
  344.         Else
  345.             destandardize$ = destandardize$ + char$
  346.         End If
  347.         punctuation = isPunctuation(char$)
  348.         If punctuation = -1 Then
  349.             destandardize$ = destandardize$ + " " + destandardize$(Right$(sample$, Len(sample$) - i - 1), -1)
  350.             Exit For
  351.         ElseIf punctuation = -2 Then
  352.             destandardize$ = destandardize$ + " " + destandardize$(Right$(sample$, Len(sample$) - i - 1), 0)
  353.             Exit For
  354.         End If
  355.     Next i
  356.  
  357. Function probability (value, mean) ' with standard deviation = 2
  358.     probability = cumulativeProbability(value + 0.5, mean, 2) - cumulativeProbability(value - 0.5, mean, 2)
  359.  
  360. Function cumulativeProbability (value, mean, deviation)
  361.     value = (value - mean) / deviation
  362.     adaptedvalue = Abs(Int(value * 100))
  363.     If adaptedvalue <= 400 Then
  364.         cumulativeProbability = GaussTable(adaptedvalue)
  365.     Else
  366.         cumulativeProbability = 1
  367.     End If
  368.     If value < 0 Then cumulativeProbability = 1 - cumulativeProbability
  369.  
  370. Sub fillGaussTable
  371.     GaussTable(0) = 0.5000
  372.     GaussTable(5) = 0.5199
  373.     GaussTable(10) = 0.5398
  374.     GaussTable(15) = 0.5596
  375.     GaussTable(20) = 0.5793
  376.     GaussTable(25) = 0.5987
  377.     GaussTable(30) = 0.6179
  378.     GaussTable(35) = 0.6368
  379.     GaussTable(40) = 0.6554
  380.     GaussTable(45) = 0.6736
  381.     GaussTable(50) = 0.6915
  382.     GaussTable(55) = 0.7088
  383.     GaussTable(60) = 0.7257
  384.     GaussTable(65) = 0.7421
  385.     GaussTable(70) = 0.7580
  386.     GaussTable(75) = 0.7734
  387.     GaussTable(80) = 0.7881
  388.     GaussTable(85) = 0.8023
  389.     GaussTable(90) = 0.8159
  390.     GaussTable(95) = 0.8289
  391.     GaussTable(100) = 0.8413
  392.     GaussTable(105) = 0.8531
  393.     GaussTable(110) = 0.8643
  394.     GaussTable(115) = 0.8749
  395.     GaussTable(120) = 0.8849
  396.     GaussTable(125) = 0.8944
  397.     GaussTable(130) = 0.9032
  398.     GaussTable(135) = 0.9115
  399.     GaussTable(140) = 0.9192
  400.     GaussTable(145) = 0.9265
  401.     GaussTable(150) = 0.9332
  402.     GaussTable(155) = 0.9394
  403.     GaussTable(160) = 0.9452
  404.     GaussTable(165) = 0.9505
  405.     GaussTable(170) = 0.9554
  406.     GaussTable(175) = 0.9599
  407.     GaussTable(180) = 0.9641
  408.     GaussTable(185) = 0.9678
  409.     GaussTable(190) = 0.9713
  410.     GaussTable(195) = 0.9744
  411.     GaussTable(200) = 0.9772
  412.     GaussTable(210) = 0.9821
  413.     GaussTable(220) = 0.9861
  414.     GaussTable(230) = 0.9893
  415.     GaussTable(240) = 0.9918
  416.     GaussTable(250) = 0.9938
  417.     GaussTable(260) = 0.9953
  418.     GaussTable(270) = 0.9965
  419.     GaussTable(280) = 0.9974
  420.     GaussTable(290) = 0.9981
  421.     GaussTable(310) = 0.9990
  422.     GaussTable(390) = 1
  423.     GaussTable(400) = 1
  424.     Dim lastValidValue As Double
  425.     Dim lastValidValuePosition As Integer
  426.     Dim nextValidValue As Double
  427.     Dim nextValidValuePosition As Integer
  428.     Dim interpolation As Double
  429.     For i = 0 To 399
  430.         If GaussTable(i) = 0 Then
  431.             nextValidValue = 0
  432.             j = i + 1
  433.             While nextValidValue = 0
  434.                 If Not GaussTable(j) = 0 Then
  435.                     nextValidValue = GaussTable(j)
  436.                     nextValidValuePosition = j
  437.                 Else
  438.                     j = j + 1
  439.                 End If
  440.             Wend
  441.             interpolation = Int((nextValidValue - lastValidValue) * (i - lastValidValuePosition) / (nextValidValuePosition - lastValidValuePosition) * 10 ^ 4) / 10 ^ 4
  442.             GaussTable(i) = lastValidValue + interpolation
  443.         Else
  444.             lastValidValue = GaussTable(i)
  445.             lastValidValuePosition = i
  446.         End If
  447.     Next i
  448.  
  449. Function compare (str1$, str2$) ' returns 0 if str1$ = str2$, 1 if str1$ < str2$, 2 if str1$ > str2$
  450.     If Len(str1$) < Len(str2$) Then compare = 1
  451.     If Len(str1$) > Len(str2$) Then compare = 2
  452.     For I = 1 To min(Len(str1$), Len(str2$))
  453.         If Asc(Mid$(str1$, I, 1)) > Asc(Mid$(str2$, I, 1)) Then
  454.             compare = 2
  455.             Exit For
  456.         End If
  457.         If Asc(Mid$(str1$, I, 1)) < Asc(Mid$(str2$, I, 1)) Then
  458.             compare = 1
  459.             Exit For
  460.         End If
  461.     Next I
  462.  
  463. Function charDistance (char$, word$, from)
  464.     charDistance = 10
  465.     For I = 0 To min(max(from - 1, Len(word$) - from), 10)
  466.         If from - I > 0 Then
  467.             If Mid$(word$, from - I, 1) = char$ Then
  468.                 charDistance = I
  469.                 Exit For
  470.             End If
  471.         End If
  472.         If from + I <= Len(word$) Then
  473.             If Mid$(word$, from + I, 1) = char$ Then
  474.                 charDistance = I
  475.                 Exit For
  476.             End If
  477.         End If
  478.     Next I
  479.  
  480. Function isSpecial (word$)
  481.     isSpecial = 0
  482.     If isPunctuation(word$) Or word$ = " " Or word$ = "" Then isSpecial = -1
  483.  
  484. Function isPunctuation (char$) ' returns -1 if next word is uppercase, otherwise returns -2
  485.     isPunctuation = 0
  486.     If char$ = "." Or char$ = "!" Or char$ = "?" Then isPunctuation = -1
  487.     If char$ = "," Or char$ = ":" Or char$ = ";" Then isPunctuation = -2
  488.  
  489. Function isUnsupported (char$)
  490.     isUnsupported = 0
  491.     If char$ = "“" Or char$ = "”" Or char$ = Chr$(13) Or char$ = Chr$(0) Or char$ = "-" Or char$ = Chr$(34) Or char$ = "/" Or char$ = "(" Or char$ = ")" Or char$ = "^" Or char$ = "[" Or char$ = "]" Or char$ = "{" Or char$ = "}" Or char$ = "_" Or char$ = "<" Or char$ = ">" Then isUnsupported = -1
  492.  
  493. Function min (int1, int2)
  494.     If int1 < int2 Then
  495.         min = int1
  496.     Else
  497.         min = int2
  498.     End If
  499.  
  500. Function max (int1, int2)
  501.     If int1 > int2 Then
  502.         max = int1
  503.     Else
  504.         max = int2
  505.     End If

2
QB64 Discussion / Reading text file already open
« on: March 09, 2019, 08:30:27 am »
Is there a way to read without error a text file already open in another program?

Pages: [1]