Skip to content

Commit

Permalink
Further clean up readme and sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
julianmichael committed Jan 9, 2020
1 parent 5efad7f commit 2cc22cc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
12 changes: 6 additions & 6 deletions README.md
Expand Up @@ -24,17 +24,17 @@ assumption that the outputs of `fastOptJS` and `aggregatedJSDeps` are available
systems, but tried and true (and only takes a few lines) in Mill projects.

The fastest way to get started is to copy the
[sample project](spacro-sample), which should compile and run out of the box. You can then modify it to your needs. Both the library code and sample code have fairely detailed comments.
[sample project](spacro-sample), which should compile and run out of the box. You can then modify it to your needs. Both the library code and sample code have fairly detailed comments.

### Sample Quickstart

* Install [Mill](http://lihaoyi.com/mill).
* Modify `spacro-sample/scripts/initSample.scala`, changing the definition of `val domain` to `localhost` or another hostname where your system can be reached.
* Execute `spacro-sample/scripts/run_sample.sh`. This will start the task server and drop you in a Scala REPL.
* Modify [`spacro-sample/scripts/initSample.scala`](spacro-sample/scripts/initSample.scala), changing the definition of `val domain` to `localhost` or another hostname where your system can be reached.
* Execute [`spacro-sample/scripts/run_sample.sh`](spacro-sample/scripts/run_sample.sh). This will start the task server and drop you in a Scala REPL.
* In a separate terminal window, run `tail -f spacro-sample/sample.log`. This will show you if the server is listening for HTTP requests (though HTTPS configuration probably failed).
* View a preview of the annotation interface at `http://<domain>:7777/task/sample/preview`.
* Preview the annotation interface at `http://<domain>:7777/task/sample/preview`.

You should see a set of instructions and a feedback/submit button. These will not work since it is just a preview, but if the preview is working, then you're ready to continue. When designing your project you can quickly iterate on the interface by accessing it through this preview.
You should see a set of instructions and some task content (including a submit button, but this will not work since it's just a preview). If you see this, then you're ready to continue. When designing your project you can quickly iterate on the interface by accessing it through this preview.

To get the task up and running on MTurk for real (or sandbox) workers, there are several more steps. The best place these are documented is in the readme for
[the QAMR project code](https://github.com/uwnlp/qamr/tree/master/code)
Expand All @@ -43,4 +43,4 @@ I might have a more proper user guide at some point.
If you run into roadblocks, your best bet is
looking at/emulating example projects,
reading the source code (which is commented),
or, if all else fails, emailing me with your questions.
or emailing me with your questions.
Expand Up @@ -35,6 +35,8 @@ class SampleExperiment(implicit config: TaskConfig) {
// in the sample task, these prompts are just strings.
val sentences = List("Hello, this is a sentence.", "This is another sentence.")

val prompts = sentences.indices.map(SamplePrompt(_)).toVector

// If you want a WebSocket connection between the server and client,
// you must define a Flow (from akka-http).
// In most cases, however, using ajax is easier and will suffice.
Expand Down Expand Up @@ -63,7 +65,8 @@ class SampleExperiment(implicit config: TaskConfig) {
// http://localhost:<http port>/task/<task key>/preview
// where a URL parameter specified at the end like ?n=1 will show the interface for the
// sample prompt at index 1 (default is 0).
val samplePrompts = Vector(SamplePrompt(0))
// Here, we're just using the full list of prompts.
val samplePrompts = prompts

// the task specification is defined on the basis of the above fields
lazy val taskSpec =
Expand All @@ -85,7 +88,11 @@ class SampleExperiment(implicit config: TaskConfig) {
lazy val hitManager = actorSystem.actorOf(
Props(
NumAssignmentsHITManager
.constAssignments[SamplePrompt, SampleResponse](helper, 1, 3, samplePrompts.iterator)
.constAssignments[SamplePrompt, SampleResponse](
helper = helper,
numAssignmentsPerPrompt = 1,
initNumHITsToKeepActive = 3,
_promptSource = prompts.iterator)
)
)

Expand Down

0 comments on commit 2cc22cc

Please sign in to comment.