cooperchris17 commited on
Commit
5a33bf8
·
verified ·
1 Parent(s): 3301a94

Upload index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +76 -0
templates/index.html ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Construction Complexity Calculator</title>
6
+ <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
7
+ <style>
8
+ body {
9
+ font-family: 'Roboto', sans-serif;
10
+ background-color: white;
11
+ color: black;
12
+ text-align: center; /* Center align all text */
13
+ }
14
+ .header {
15
+ background-color: black;
16
+ color: white;
17
+ padding: 10px;
18
+ text-align: center; /* Center align header text */
19
+ }
20
+ form {
21
+ display: inline-block; /* Center the form */
22
+ text-align: left; /* Align form elements to the left */
23
+ }
24
+ label, textarea, input[type="file"], input[type="submit"] {
25
+ display: block;
26
+ margin: 0 auto; /* Center form elements */
27
+ }
28
+ textarea {
29
+ width: 100%; /* Adjust width as needed */
30
+ }
31
+ </style>
32
+ <script>
33
+ function showProcessingMessage() {
34
+ document.getElementById('processing-message').style.display = 'block';
35
+ }
36
+
37
+ function handleFormSubmit(event) {
38
+ event.preventDefault();
39
+ showProcessingMessage();
40
+
41
+ const formData = new FormData(event.target);
42
+ fetch('/process', {
43
+ method: 'POST',
44
+ body: formData
45
+ })
46
+ .then(response => response.text())
47
+ .then(data => {
48
+ document.getElementById('processing-message').innerHTML = data;
49
+ })
50
+ .catch(error => {
51
+ console.error('Error:', error);
52
+ document.getElementById('processing-message').innerHTML = 'An error occurred during processing.';
53
+ });
54
+ }
55
+ </script>
56
+ </head>
57
+ <body>
58
+ <div class="header">
59
+ <h1>Construction Complexity Calculator</h1>
60
+ </div>
61
+ <p>This tool calculates the complexity measure described in Nelson (2024).</p>
62
+ <p>For multiple texts, click "upload" and select the .txt files. For one text, paste it into the box. When your texts are ready, click "Process Input".</p>
63
+ <p>Refresh your browser to run the tool on a different text or set of texts (after processing has finished).</p>
64
+ <br>
65
+ <form action="/process" method="post" enctype="multipart/form-data" onsubmit="handleFormSubmit(event)">
66
+ <label for="text">Input text:</label><br>
67
+ <textarea id="text" name="text" rows="10" cols="50" placeholder="Copy and paste text here"></textarea><br><br>
68
+ <label for="files">Upload files:</label><br>
69
+ <input type="file" id="files" name="files" multiple accept=".txt"><br><br>
70
+ <input type="submit" value="Process Input">
71
+ </form>
72
+ <p id="processing-message" style="display:none;">Processing (this could take some time)...</p>
73
+ <p>Read the Open Access paper for full details about the complexity measure and please cite it in your research if you use the tool:</p>
74
+ <p>Nelson, R. (2024). Using constructions to measure developmental language complexity. Cognitive Linguistics. <a href="https://doi.org/10.1515/cog-2023-0062">https://doi.org/10.1515/cog-2023-0062</a></p>
75
+ </body>
76
+ </html>